Freeing a rotational axis with a 6DofConstraint
Posted: Tue Dec 15, 2009 6:23 am
I am using a Generic6DofConstraint to implement an upright constraint that keeps my (capsule) actors from falling over while they move. I am interested in locking the X and Z axes, Y is up in my case and I want to have that axis free (see below).
Here I am attempting to limit the Y axis with the documented convention that high < low means that the axis is free. The result is that after the value for Y rotation goes past -pi/2 or +pi/2 (i.e. over 90 degrees to either side), the simulation explodes. Using -SIMD_INFINITY, SIMD_INFINITY as the limits does not help, as they are just normalized to -pi/2, +pi/2 inside btGeneric6DofConstraint::setLimit.
If I constrain the Y axis with the limits 0,0, everything is fine and the axis is locked. However, I need the capsule to be able to pull around another rigid body on the X-Z-plane, and that requires the capsule to be able to spin around the Y axis. The pulling works just fine with a Generic6DofSpringConstraint, the problem is that using these two together (upright + pull), does not work.
Any advice is greatly appreciated.
Code: Select all
pConstraint->setLimit(0, -SIMD_INFINITY, SIMD_INFINITY);
pConstraint->setLimit(1, -SIMD_INFINITY, SIMD_INFINITY);
pConstraint->setLimit(2, -SIMD_INFINITY, SIMD_INFINITY);
pConstraint->setLimit(3, 0, 0);
pConstraint->setLimit(4, 1, 0);
pConstraint->setLimit(5, 0, 0);
If I constrain the Y axis with the limits 0,0, everything is fine and the axis is locked. However, I need the capsule to be able to pull around another rigid body on the X-Z-plane, and that requires the capsule to be able to spin around the Y axis. The pulling works just fine with a Generic6DofSpringConstraint, the problem is that using these two together (upright + pull), does not work.
Any advice is greatly appreciated.