6Dof constraint with cylinder wheels for a car.

zbethel
Posts: 6
Joined: Sun Jul 01, 2012 5:15 am

6Dof constraint with cylinder wheels for a car.

Post by zbethel »

Greetings,

I'm trying to learn how to simulate a car using basic cylinders for wheels and a spring 6DOF constraint for the shocks. The issue I'm having is that in order to orient the wheels correctly, I have to rotate them about the Z axis 90 degrees (y is up in the world). Then, when I go to constrain rotation with setAngularLowerLimit and setAngularUpperLimit, it seems to get in a gimbal lock when I try to free the y axis and lock everything else. I tried rotating the local frame of the constraint and all it did was rotate the cylinder on its side. How can I avoid messing up the basis vectors when constraining with a rotated body?

Thanks!
zbethel
Posts: 6
Joined: Sun Jul 01, 2012 5:15 am

Re: 6Dof constraint with cylinder wheels for a car.

Post by zbethel »

Okay, so I noticed that if I don't pre-rotate the rigid body before constraining it, it will rotate into place and work just fine. Is there a way to make it instantaneously fix itself? It looks kind of funny spawning the car and having the wheels flip 90 degrees into place.