ไม่สามารถเล่นวิดีโอนี้
ขออภัยในความไม่สะดวก

2D Game Physics 4: Pre-Collision Detection Optimizations

แชร์
ฝัง
  • เผยแพร่เมื่อ 16 ส.ค. 2024
  • A mix of some generally accepted pre-collision detection optimizations, as well as some of my own ideas on the topic.
    There's so much more than I can fit into one video, and this is an active area of research. But I didn't want to get into anything excessively advanced, like pre-computing trajectories, moving coordinate systems, combining hierarchical bounding models, etc, each of which could offer hypothetical performance boosts in niche applications. Don't be afraid to experiment yourself, and post your results in the comments.
    Wiki has a decent article on this topic: en.wikipedia.o...
    Full playlist: • 2D Game Physics
    You can support this channel on patreon: / jsideris

ความคิดเห็น • 22

  • @teucay7374
    @teucay7374 4 ปีที่แล้ว +4

    This is very useful! I am writing a 2D game engine with C++ and SFML and it is rare to find content of this quality. Good job!

  • @carlosfernandez5833
    @carlosfernandez5833 4 ปีที่แล้ว +6

    This guy knows how to hook a brother up with some free maths!

  • @medvidekkrupicka1404
    @medvidekkrupicka1404 6 ปีที่แล้ว +2

    These are very interesting lectures. Many thanks!

  • @OfficialJabe
    @OfficialJabe 2 ปีที่แล้ว

    This video was exactly what i was looking for. You've earned yourself a subscriber

  • @piti-sukkah
    @piti-sukkah 6 หลายเดือนก่อน +1

    Wish there was that next video 😢

    • @jaimewol1238
      @jaimewol1238 6 หลายเดือนก่อน +1

      Hopefully one day that will happen. It was very useful anyway.

  • @AnilRai-jj2cq
    @AnilRai-jj2cq 5 ปีที่แล้ว +2

    How to check between circle and rectangle

  • @garrettb619
    @garrettb619 6 ปีที่แล้ว +7

    How about that new video though?

    • @JoshSideris
      @JoshSideris  6 ปีที่แล้ว +2

      Okay I'll work on it haha. It's a lot of work to make these!

    • @huffmancollins614
      @huffmancollins614 3 ปีที่แล้ว

      @@JoshSideris great video series: i hope you get around to finishing it

    • @3iggystheorem232
      @3iggystheorem232 3 ปีที่แล้ว +1

      @@JoshSideris hurry you bastard

  • @IOKFORLIFE
    @IOKFORLIFE 5 ปีที่แล้ว +1

    Can you show us how to do collision detection for rectangle objet having a rotation?

  • @hopelessdigger
    @hopelessdigger 4 ปีที่แล้ว +5

    i have been searching rect vs circle intersection for days and found nothin'...

    • @randominternetperson2215
      @randominternetperson2215 4 ปีที่แล้ว +1

      There may be a more efficient way to do this, but that's what I came up with:
      measure the distance between the Rectangle and the circle's center and check if it's less than the circle's radius.
      That's how I measured the distance: Assume the rectangle's top left corner is at (x1, y1), its height is h, and its width is w. The center of the circle is defined as (x2, y2) and the radius is r.
      The rectangle's center would be at (x1+w/2, y1+h/2).
      Thus the distance would be
      √(max(|x1+w/2-x2|-w/2,0)²+max(|y1+h/2-y2|-h/2,0)²)
      //Basically if |x1+w/2-x2|-w/2 is smaller than 0 that means that the answer is the change in y. If |y1+h/2-y2|-h/2 is smaller than 0 that means that the answer is the change in y. If they're both 0, that means the circle's center is within the the rectangle's bounds which means there is intersection. If neither is 0, it basically returns the distance to the nearest corner and uses the distance formula √(dy²+dx²).
      So finally we would have return √(max(|x1+w/2-x2|-w/2,0)²+max(|y1+h/2-y2|-h/2,0)²)

    • @hopelessdigger
      @hopelessdigger 4 ปีที่แล้ว +1

      @@randominternetperson2215 well thank you in the first place but i don't think that this is 100% working.. i mean i saw someone wrote 100% working equation but it was very complex and not as simple as this(i didn't try it because it was long and complex), so anyway I'll try your way and hopefully it will work.

    • @randominternetperson2215
      @randominternetperson2215 4 ปีที่แล้ว +1

      @@hopelessdigger Alright. It is very possible that I have a typo somewhere so let me know if this works or no

    • @hopelessdigger
      @hopelessdigger 4 ปีที่แล้ว +1

      @@randominternetperson2215 i tried it, i'm sorry it didn't work.
      apparently, the top left corner only seems to work idk why.

    • @randominternetperson2215
      @randominternetperson2215 4 ปีที่แล้ว +1

      @@hopelessdigger did you include the absolute values?

  • @t0x1cd
    @t0x1cd 2 ปีที่แล้ว

    What happened to making more videos

  • @hopelessdigger
    @hopelessdigger 4 ปีที่แล้ว

    how is geometry dash physics programmed??

    • @brawldude2656
      @brawldude2656 2 ปีที่แล้ว

      There are not much physics. The player doesn't bounce off a tringle and change its direction or something. You just have to check collisions at players current x. Because, you know there are no collisions between other objects. Also there is no complicated shape in gd.