AABB to AABB collision response/correction help..

Started by
2 comments, last by ArchangelMorph 15 years, 6 months ago
I've been trying to get my collision code to work properly for a while now.. so far I managed to get an AABB to trimesh algorithm which works *reasonably* well but for some reason I can't quite put an algorithm together which does AABB to AABB response properly.. I have no problem using Separating Axis Theorem to test if a collision has occured but I need to figure out how to correct the positions of my AABBs.. Please could some one help me deal overlap detection & positional correction between the following sample case:- One static AABB and one AABB moving at a set velocity and colliding with the static one.. This would really help me move along from this issue that has had me bogged down for far too long.. Please help.. :(
Advertisement
the SAT can give you the MTD (minimum translation distance). That in turn can be used to apply a response along the MTD. It depends what kind of response you want though.


here is an example of the SAT (which you know already), but with teh MTD calculation.

here is my own cooked up version, with various collision responses. It's in 2D, but 3D is the same principle.


Everything is better with Metal.

Handling collisions depends a lot on what you actually want to happen. Pushing out objects along the shortest path is relatively easy: you're already doing SAT tests, so it's a matter of checking the smallest penetration and moving the object along that axis.

However, if you were to use that for, say, your main character, and he'd be walking up a slope, he'd be walking slower because the push is partially pushing him back horizontally also. That's why it's important to decide what exactly needs to happen in what case. Once you've got that clear in your mind, working out the exact behavior will be easier.

EDIT: Too slow, heh. ;)
Create-ivity - a game development blog Mouseover for more information.
Thanks a bunch guys!!

This topic is closed to new replies.

Advertisement