Moving Sphere against AABB Collision

Started by
13 comments, last by RPTD 13 years, 4 months ago
Looks like my SphereMoveHitsBox code has a bug yielding false positives. Looking around the net though I could not find a working example of a moving sphere against AABB collision test. Anybody knows how this can be done if it can be done?

Life's like a Hydra... cut off one problem just to have two more popping out.
Leader and Coder: Project Epsylon | Drag[en]gine Game Engine

Advertisement
Of course it can be done :) (Check geometrictools.com for an example implementation.)
I've checked this place already. There is no "moving" sphere-aabb test only a static sphere-aabb test... unless I overlocked something.

Life's like a Hydra... cut off one problem just to have two more popping out.
Leader and Coder: Project Epsylon | Drag[en]gine Game Engine

You can either step the sphere along the path, ie a swept sphere, or possibly use the sphere's displacement as a ray and see if it intersects the box.

Ericson's Real Time Collision Detection is excellent and I think has some examples of a swept sphere.
A stepped sphere is not an option, I need correct TOI (Time Of Impact). What's this "Ericson's Real Time Collision Detection"?

Life's like a Hydra... cut off one problem just to have two more popping out.
Leader and Coder: Project Epsylon | Drag[en]gine Game Engine

Quote:Original post by RPTD
I've checked this place already. There is no "moving" sphere-aabb test only a static sphere-aabb test... unless I overlocked something.
Take another look at the 'intersection' section (there's a section with the heading 'Intersection of boxes and spheres (3D). Includes the cases of moving spheres and boxes.').
Quote:Original post by RPTD
What's this "Ericson's Real Time Collision Detection"?
It's a book by Christer Ericson. (I don't have it in front of me right now, but IIRC it doesn't cover the specific case of moving sphere-vs.-box. Again though, I'm not looking at it right now, so don't hold me to that. If you want to know for sure, you could probably find the TOC online somewhere.)
I could be blind but there is no entry under "Intersection" even remotely matching the suggested name. The only thing I found is "Intersection of Convex Objects: The Method of Separating Axes" which also contains SAT for moving objects. Unfortunately this doesn't seem to properly work with sphere versus a box. I implemented this one and it works in some cases but the simple case of a sphere moving along a box axis towards an edge without hitting it results in incorrect early collision. Most probably incomplete axis set but I really have no idea anymore what else I could include (I'm using box axis x/y/z, moving direction and moving direction cross box axis x/y/z).

Life's like a Hydra... cut off one problem just to have two more popping out.
Leader and Coder: Project Epsylon | Drag[en]gine Game Engine

I'm referring to the source code section, here.
Ah, found it now. I always looked under the "documentation" place as this is where the papers are located. Thanks for the tip.

Life's like a Hydra... cut off one problem just to have two more popping out.
Leader and Coder: Project Epsylon | Drag[en]gine Game Engine

Took a look at the sources. From what I get they use something similar to mine just with the problem that this is not correctly working. An important border case is not handled which is exactly the one causing me to look for a better algorithm. Shoot... looks like their code example won't be of help as it is incomplete as mine.

Life's like a Hydra... cut off one problem just to have two more popping out.
Leader and Coder: Project Epsylon | Drag[en]gine Game Engine

This topic is closed to new replies.

Advertisement