ไม่สามารถเล่นวิดีโอนี้
ขออภัยในความไม่สะดวก
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
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!
This guy knows how to hook a brother up with some free maths!
These are very interesting lectures. Many thanks!
This video was exactly what i was looking for. You've earned yourself a subscriber
Wish there was that next video 😢
Hopefully one day that will happen. It was very useful anyway.
How to check between circle and rectangle
How about that new video though?
Okay I'll work on it haha. It's a lot of work to make these!
@@JoshSideris great video series: i hope you get around to finishing it
@@JoshSideris hurry you bastard
Can you show us how to do collision detection for rectangle objet having a rotation?
i have been searching rect vs circle intersection for days and found nothin'...
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)²)
@@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.
@@hopelessdigger Alright. It is very possible that I have a typo somewhere so let me know if this works or no
@@randominternetperson2215 i tried it, i'm sorry it didn't work.
apparently, the top left corner only seems to work idk why.
@@hopelessdigger did you include the absolute values?
What happened to making more videos
how is geometry dash physics programmed??
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.