Managing collisions by projection

Started by
1 comment, last by Erik Sintorn 19 years, 11 months ago
I am writing a collission detection engine based on the paper "Advanced Character Physics" by Thomas Jakobsen. In this he describes how a rigid body can be represented by four particles and six stick constraints. Collissions are handled simply by finding any particle that has crossed a boundrary (in the examples in the paper, no particle can be outside a specified box) and projecting it back inside. This is all fine when the constraints are as simple as keeping a particle in a box, but what I want to do is to keep an arbitrary closed mesh outside any other closed mesh. I do this now by building an aabb-tree of each mesh, and check each tree against any other tree. If two leaf nodes are found to collide (each leaf contains only one triangle), the following is done: For both triangles: For each vertex of triangle: Shoot a ray from the vertex in the direction of it''s negative normal. If it hits the other triangle the intersection point is found and the vertex is moved to that point. This seems to work, but it''s terribly slow. What I would really like, i guess, is some simple and fast method that takes two triangles and finds the shortest distance (and direction) that one of them needs to be moved so that they won''t intersect anymore. Could anyone help me? Erik Sintorn
Advertisement
I''ve been tinkering with this idea. One way I use for finding the collision depth of convex objects (mainly box/box, but works for triangle-box and triangle-triangle), is use the separating axis test, but extended slightly. The MTD (minimum translational distance), which is what you are looking for, can be found by taking the minimum overlap distance between all the axes. That will give you a normal and a depth. So basically, that''s the direction of movement, and the depth you need to translate your triangles. You may have to invert the direction, since the direction of the separating axis is pretty much random.

I''d like to try the idea, once I''ve got time. It''s basically setting up a 4-vertex frame, and using the MTD of two intersecting triangle, push the frames away so they stop intersecting. They should rotate, as well as bounce. One major problem, is to find the right size and shape of the frame (tetrahedron), which would ultimately simulate the inertia of the body.

I have a demo, which is based roughly on that idea, except that I only check vertices at the moment, and I generate a temporary constrain from the collision point and add it to a list. I don''t use a set of linear equations to calculate the weights at the vertices of the shape. So, slightly different method.

http://uk.geocities.com/olivier_rebellion/heightmap.zip

you may have to download it from the main page.

Everything is better with Metal.

*double post*

[edited by - oliii on May 8, 2004 5:38:59 PM]

Everything is better with Metal.

This topic is closed to new replies.

Advertisement