I have 2 rigid-bodies (b1,b2) if i linked one to the other (as if they are conjoined together) , how to represent b1 effect on b2 and b2 effect on b1
Is there any LAW that affect the position/orientation of the other body ?
notes :
- i am using Quaternions for orientations
- i don't want to treat them as one body
- i have only primitive shapes (box,sphere,..) to link.
Answer
The open-source physics engine ODE allows you to connect two bodies using any of a number of different joints. One of those joints is the "Fixed" joint. It's much more stable, in the physics engine, to represent the two bodies as a single body but maintain two separate geometries for collision purposes. However, ODE probably handles collision detection/resolution differently from what you have in mind. It only detects collision after one frame of interpenetration and then constrains the relative velocity of the colliding bodies in such a was as to force them apart on the next time step. That type of constraint is much easier to satisfy for a single rigid body than two, but perhaps you're actually preventing penetration and so need a different technique.
The fixed joint simply constrains the two bodies to have zero relative angular velocity and zero relative linear velocity (and also has an error correction term to eliminate small numerical drift). After that, the LCP solver handles the rest.
No comments:
Post a Comment