Angular constraints and baumgarte

User avatar
John McCutchan
Posts: 133
Joined: Wed Jul 27, 2005 1:05 pm
Location: Berkeley, CA

Angular constraints and baumgarte

Post by John McCutchan »

Hey all,

I've been working on deriving all of the constraints from first principles but I'm getting stuck on angular constraints. Let's say I want to stop rotation around axis A. The jacobian would be:

Dc/dt = [0 0 0 Ax Ay Az 0 0 0 -Ax -Ay -Az]

I can't figure out how to formulate it at the position level (C) properly. In the angular cases is the baumgarte still (C / dt) ?

Is there a technique for constructing angular constraints at the position level and their baumgarte term?

Thanks!
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Post by Dirk Gregorius »

I use a different formulation for the angular constraint. Given the constraint space u, v and w you can block the rotation around u like this:

C = v1 * w2
dC/dt = 0 (v1 x w2) 0 -(v1 x w2)

You could also try the following, but note that I never checked this. Compute the difference quaternion dq = Conjugate(q1) * q2. The length of the quaternion axis is sin( alpha/2 ). For small deviations you can use a small angle approximation, so sin( alpha/2 ) ~ alpha/2. You need to scale the axis by a factor two then and project onto your constraint axis.

q32 dq = Conjugate(q1) * q2;
v32 q_axis = GetAxis( dq );
q_axis *= 2;

f32 C = Dot( q_axis, constraint_axis );
f32 baumgarte = 0.1 * C/dt;

This can be total nonsense. But if you give a try let me know how it worked. Your question was answered in the forum before. You can search for Erin Catto's and my recent posts and should find what you are looking for. I also recommend looking at the ODE constraint Universal, Hinge and Fixed.

Cheers,
-Dirk