Archived

This topic is now archived and is closed to further replies.

houdas_cz

Verlet physics - OBB collision response

Recommended Posts

houdas_cz    122
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

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


Link to post
Share on other sites