Structure for different kind of collision

Started by
12 comments, last by Kwizatz 14 years ago
The circle SAT has been demonstrated here.

It's in 2D, the problem with 3D is you get an explosion of tests to perform. You will have to test the sphere against the vertices, the sphere against the edges (I would say, the closest point on the edge to the sphere centre will give you an axis).

Of course you can optimise the test to reduce the features that could give a potential separating axis (there is no reason to test the 'back' features). Then in the end, the SAT sphere test becomes really close to the standard sphere-convex hull test anyway.

IIRC, the standard way of checking a sphere with a convex hull for intersection if finding the point on the hull the closest to the sphere centre, which basically involve some form of Voronoi diagram (partitioning space to find the closest features) to identify the potential parts needed for the tests (vertices, edges, faces).

V-Clip does this for polytopes vs polytopes iirc, but imo there is no reason why it wouldn't work for spheres as well.

Everything is better with Metal.

Advertisement
Correct, the advantage in the way I am proposing is in the abstraction, you forget about shapes and test only axes and intervals, thus, you can have a single collision test function instead of one for each pair of shapes, the complexity then becomes providing an optimized set of axes for each shape based on the rough position of a second shape.

Or at least that's my idea [smile].
Thanks guys for sharing good ideas. So I think it's possible to make the test by one function but it's too complex and not optimized. right?

I think I should use different optimized ways to check collisions in practice.
Quote:Original post by comdown
So I think it's possible to make the test by one function but it's too complex and not optimized. right?


Not really, all things being equal, implementing either solution would yield roughly the same performance (plus/minus a virtual call), the difference is in the code structure and volume (that's my hypothesis anyway).

This topic is closed to new replies.

Advertisement