AABB > AABB collision response?

Posted by Levi on Game Development See other posts from Game Development or by Levi
Published on 2012-04-01T16:43:39Z Indexed on 2012/04/01 17:43 UTC
Read the original article Hit count: 392

I'm really confused about how to fix this in 3d? I want it so that I can slide along cubes but without getting caught if there's 2 adjacent cubes. I've gotten it so that I can do x collision, with sliding, and y, and z, but I can't do them together, probably because I don't know how to resolve it correctly. e.g.

[]

[]

[]^

[]O

[]

O is the player, ^ is the direction the player is moving, with the methods which I was trying I would get stuck between the cubes because the z axis was responding and kicking me out :/. I don't know how to resolve this in all 3 direction, like how would I go about telling which direction I have to resolve in. My previous methods involved me checking 4 points in a axis aligned square around the player, I was checking if these points where inside the cubes and if they where fixing my position, but I couldn't get it working correctly. Help is appreciated.

edit: pretend all the blocks are touching.

© Game Development or respective owner

Related posts about XNA

Related posts about c#