AABB to AABB Collision 2D
384
2021-06-06に共有
I'm just going to share this because why not :P
Just me making quick and simple 2D collisions so I can extend them to 3D.
I did not use any control blocks. This means no loops, if-then statements, wait until blocks, etc... Because of that, this project has a bit too many blocks lol
Black arrows are surface normals which are based on player velocity. The orange arrow is a surface normal which is based off of the positions and dimensions of the bounding boxes. The orange arrow will turn green if it is aligned with a velocity-based normal, and it will turn magenta if the player is colliding with the medium. The magenta normal, which has a magnitude of one, is multiplied by the penetration depth, a scalar, of the hitboxes, to give a vector to push out the player.
Feel free to ask for clarification :P
CREDITS:
@Kouzerumatsu/@Kouzone made this, and I guess I remade it with extra steps:
https://www.desmos.com/calculator/rjwcoqpsv3