DanielChappuis / reactphysics3d

Open source C++ physics engine library in 3D
http://www.reactphysics3d.com
zlib License
1.54k stars 223 forks source link

Some questions about your document, Constraints Derivation for Rigid Body Simulation in 3D #48

Closed FantasyVR closed 6 years ago

FantasyVR commented 6 years ago

With the help of my friends out of China, I can read your document, finally. But I still get some questions about this document.

  1. In your document, you just write about how to solve constraints on the velocity level. https://github.com/DanielChappuis/reactphysics3d/blob/8da1aa63cce5e94dc4ed24d11e1c1558c021856c/src/constraint/BallAndSocketJoint.cpp#L124 In the source code, you also give us the solution on the position level. https://github.com/DanielChappuis/reactphysics3d/blob/8da1aa63cce5e94dc4ed24d11e1c1558c021856c/src/constraint/BallAndSocketJoint.cpp#L156 And I found Jan Bender use the same manner to deal with position constraints in his project which is a implementation of his paper.

I want to know if you have the derivations on the position level.

  1. In your document, you just write in page 6 that

    In general, the velocity constraint looks like this: Equation (16).

Why does velocity constraints look like Equation (16)?

DanielChappuis commented 6 years ago

Hello,

  1. To correct the numerical drift in the simulation, I use the pseudo velocity technique (Non-linear Gauss Seidel) for position correction that is described by Erin Catto here (from slide 53).

  2. In this equation, the part J * v(t) is the result of the time derivation (see equation 15) and the b vector is used to add work into the constraint (to correct for numerical drift or to simulate a motor for instance). This is really well explained in another presentation from Erin Catto (see slide 24).

I hope this helps.