Jump to content
  • Advertisement
Sign in to follow this  
RPTD

Moving Sphere against AABB Collision

This topic is 2755 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
Of course it can be done :) (Check geometrictools.com for an example implementation.)

Share this post


Link to post
Share on other sites
I've checked this place already. There is no "moving" sphere-aabb test only a static sphere-aabb test... unless I overlocked something.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
A stepped sphere is not an option, I need correct TOI (Time Of Impact). What's this "Ericson's Real Time Collision Detection"?

Share this post


Link to post
Share on other sites
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.)

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
Ah, found it now. I always looked under the "documentation" place as this is where the papers are located. Thanks for the tip.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!