2D Moving Hitbox Collision Detection And Tunnelling

preview_player
Показать описание
Learn how to do 2D collision detection and response between moving objects for a game simulation. This video covers broadphase collision detection and intuitive collision resolution based on how two objects enter collision. This technique is particularly useful for platforming games.

Рекомендации по теме
Комментарии
Автор

Hey, everybody! Thanks for watching this video. If you have any questions or suggestions, please comment! I'm currently investigating solutions for 2D collision detection and response for arbitrary convex polygons, so please be patient as these examples take a bit longer to code.

PothOnProgramming
Автор

omg finally!! I've been breaking my head trying to figure out how to do collisions, I even tried to check for imaginary points in front of a rectangle to see if they were inside of the platforms. Thank you!

Angry-Panda-Studios
Автор

you just ended days of frustration trying to figure out collisions in Flutter Flame Game. Thank you.

WerdOriginss
Автор

Thank you so much for this Video! A little addition: If you have 2 collisions at once while sliding aorund a collider wich transitions into another collider, it could happen that you stuck on the first collider based on wich collider you check first. The solution is to check that collider first you are overlapping the most with.

FleMoo
Автор

very helpful love the visualizing examples

brianoh
Автор

Good Video and Explanation, but I would've enjoyed to hear more about of sweeping / swept volumes, instead of tips like "make it move less".

floskater
Автор

That's what I should do for monogame! Use an object rectangle! Not a sprite list class! This makes sense!

soundrogue
Автор

I don't really understand the old and new position. I am trying to re-create it in my code but both values read the same

ElitdGaming
Автор

this is a really good collision detection, but here is a problem. So if platforms are snapped to grid like a tile map and when the player is sliding on walls, it just gets stuck by top or bottom collision. Are there any solutions how to fix this?:)

grishakek
Автор

Sweeping wont work if either of the cubes rotate during the journey, will it? I mean, if the cubes can be rectangles.

asyncasync
Автор

can we not use loop to solve tunneling to some extent? But it will slow down the game.

abhinavsinghchauhan
Автор

But, check for collision with all objects in each frame is not bad?
If I want, for example, the objects to collide with another objects, it would make the game performance bad...
We would had a n² number of checks in each frame
What should I do in this case?

Thanks for the video man!

CaioLesnock
Автор

Thank you for the video, unfortunately I was already wondering why the collideRectangle discards any non-colliding rectangles. In the figure showing the sweeping iteration, it can be clearly seen that tunnelling can also occur without any intersection in either the previous frame or the current frame. Also, I think not using a library for 2D vectors is not the most elegant decision. (I have to admit, I did not watch the video to the end.)

necrowizzard
Автор

I don't think this is an example of tunneling. I thought tunneling were when the program doesn't run quick enough so if you for example have a really tiny platform in a 2D game you can fall through it if you have enough speed because as you kind of explained it skipped the collision by moving with a big step.

gabriel_wingard