Moving Sphere against AABB Collision

Started by
13 comments, last by RPTD 13 years, 4 months ago
Could you explain said border case? (I haven't bothered looking at the link)

What you're asking for should be pretty straightforward. I can only really invision three collision cases:
  • sphere with side
  • sphere with edge
  • sphere with corner


The first is very similar to testing for AABB collisions, and the last is almost identical to sphere-sphere. The second is a little trickier I guess, I'd be projecting to a plane to which the edge is normal (for AABBs that's effectively just ignoring a co-ordinate) to effectively turn it into a 2D circle-point problem.

If you provide a little more detail on motion (obviously the nature of motion of objects involved is typically very important in a priori), I might be able to give a better response.
Advertisement
I'd be a little surprised if the code you found there was incomplete. What's the border case you refer to?
The problem is a sphere near an edge with a velocity aligned with a box axis. In my case I had a tilted box connecting to another non-oriented box (sort of ramp up to a plateau). Getting close to the plateau-box collision acts weird detecting collisions too soon leading to the player (the sphere) making a motion like moving over a bump at the edge.

From my look through the code though I think I see what they try to do. To my understanding all three cases should be doable with a closed solution. I've to calculate this through on a piece of paper then I know more.

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

Well, that sounds like an ill-conditioned numerical solution. This stuff is always a bit of a bitch.

I imagine you should have sphere-edge down to circle-point, no? Looking back on some working I did on this stuff a while ago, circle-point (or hypersphere-hypersphere in general) is a quartic problem under constant acceleration, or a quadratic problem under no acceleration. I know of situations in which quadratic closed forms can go ill numerically, and I know of work-arounds to that; but quartics and other means are another kettle of fish entirely.

Could you be more specific about which (regardless of whether or not it's either of these) your situation is? I cbf looking at jyk's code, especially given it may or may not be relevant to your problem.
Got it working now using my own code with closed solutions. Quite a bit shorter than the version mentioned on that page and so far stable and working correctly in my tests. Boils down to testing at max 3 faces (sphere-AArect), 3 edges (sphere-AAedge) and 1 vertex (sphere-vertex). All of them closed solutions including one simple quadratic equation for each edge test. The code is actually quite simple and should (from my judging) not be affected much by numerical instability even if used with float instead of double. Runs smooth and stable here. For me that's enough.

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