btGeneric6DofSpringConstraint - lock angular axis

snubbykins
Posts: 2
Joined: Tue Apr 16, 2013 9:04 pm

btGeneric6DofSpringConstraint - lock angular axis

Post by snubbykins »

I'm attempting to create a linear suspension constraint between a car chassis and wheel.

However the btGeneric6DofSpringConstraint does not seem to rigidly lock rotation, even after setting the spring to false and setting the lower and upper limits.

Under force, the constraint will still rotate and spring back to the starting position, is it possible to prevent any rotation from occurring on the constraint?

e.g

Code: Select all

// Create suspension constraint
btGeneric6DofSpringConstraint *spring = new btGeneric6DofSpringConstraint(
	*bodyA, *bodyB, 
	btTransform(btMatrix3x3::getIdentity(), btVector3(1.1, -1, 2)),
	btTransform(btMatrix3x3::getIdentity(), btVector3(0.f, 0.f, 0.f)),
	true);

// Attempt to lock constraint rotation
spring->enableSpring(3, false);
spring->enableSpring(4, false);
spring->enableSpring(5, false);
spring->setAngularLowerLimit(btVector3(0.f, 0.f, 0.f));
spring->setAngularUpperLimit(btVector3(0.f, 0.f, 0.f));
Cheers :)
snubbykins
Posts: 2
Joined: Tue Apr 16, 2013 9:04 pm

Re: btGeneric6DofSpringConstraint - lock angular axis

Post by snubbykins »

So I found the problem in the end.

I was attaching the wheels to a small dummy object, which then attached to the chassis, the low mass of the dummy object caused the constraint to become flexible.