Verlet physics - OBB collision response

Started by
5 comments, last by houdas_cz 20 years, 7 months ago
I am trying to make rigid body simulator using verlet integration. I use oriented bounding boxes, the collision detection routine works quite well, it returns: - two points of intersection - the depth of penetration - type of contact (corner/plane, edge/edge etc..) The question is - what should i do with these results? Which vertices on the OBBs should i move and in which direction to make the colliding objects rotating/moving correct? I can move only with vertices because i am using verlet integration. Thanks a lot
Advertisement
If a vertex has crossed/collided with a triangle, move the vertex
in the direction of the triangle-normal by the appropriate distance. Then I suppose you run another "satisfy-constraints"-loop so the rest of the vertices are updated when needed.
I haven''t implemented this myself, but that''s what I''ve gathered from "Advanced Character Physics" by Thomas Jakobsen.
Yeah, try so that the offending vertices (2 vertices if it is an edge, one if it''s a corner, 4 if it''s a face) get pushed to a point where the contact point on the box and the contact point on the triangle meet. So push the vertices by

(PointOnTriangle - PointOnBox) * fRelaxation;

I''d say fRelaxation between 0.2f and 1.0f max for maximum rigidity (although it makes the simulation a lot more unstable).

Everything is better with Metal.

Thanks guys, its working, whooah =]
Any screens?
"Make it a habit to be loyal to the activities that serve the highest part of yourself."
houdas_cz (or anyone): Perhaps you can help me with ''extracting'' the orientation of a tetrahedron after the verlet-integrator has updated its vertices/particles?
(To attach a model to a tetrahedron..) I''ve googled a bit, but I can''t seem to find anything that helps.
I would think you do something like so :

Just take 2 of the tetrahedron edges that meet at a vertex.

if you have a,b,c,d, as vector3s, and abc are the bottom 3 points and d is the top one,

D3DXVECTOR3 edge0( b - a );
D3DXVECTOR3 edge1( c - a );

D3DXVECTOR3 y;
D3DXVec3Cross( &y, &edge0, &edge1 );

D3DXVECTOR3 x;
D3DXVec3Cross( &x, &y, &edge0 );

D3DXVECTOR3 z;
D3DXVec3Cross( &z, &y, &x );

now x, y and z form an orthogonal coordinate frame ( 3x3 rotation matrix ).

This is assuming you are not trying to deform your tetrahedron...

This topic is closed to new replies.

Advertisement