I'm trying to implement the verlet integration for rigid bodies.
So far, I've implemented the Euler integration as follow
LinVelocity += LinAcceleration * dt;
RotVelocity += RotAcceleration * dt;
Position += LinVelocity * dt + LinAcceleration * (dt*dt*0.5f);
//----------------------------------------------------------------------
// Poisot equation to integrate for orientation
//----------------------------------------------------------------------
Quaternion Qvel = Quaternion(RotVelocity, 0) * Q * 0.5f;
Quaternion Qaccel = Quaternion(RotAcceleration, 0) * Q * 0.5f;
Q += Qvel * dt + Qaccel * (dt*dt*0.5f); // standard euler equation, like for position
and I've got this for verlet integration
//-------------------------------------------------------
// Verlet Integration
// x' = 2x - x° + a * §t² => x += (x - x°) + a * §t²
//-------------------------------------------------------
Vector Temp = Position;
Position = Position*2.0f - PrevPosition + LinAcceleration * (dt*dt);
PrevPosition = Temp;
LinVelocity = (Position - PrevPosition) / dt;
Quaternion Qaccel = Quaternion(RotAcceleration, 0) * Q * 0.5f;
Quaternion TempQ = Q;
Q = Q*2.0f - PrevQ + Qaccel * (dt*dt);
PrevQ = TempQ;
//RotVelocity = ?????????????
Now, I need to extract the rotational velocity out of it. I'm not sure of the math. For the moment, I integrate with verlet for the linear movement, and with euler for the roational movement. I'm hoping a full verlet integration would make the system more stable.
Thanks for your help
non!
[edited by - oliii on March 21, 2003 8:17:09 AM]