# Avoiding lumped vehicles from falling over?

## Recommended Posts

D3DXQuaternionRotationYawPitchRoll(&newQ, yaw, pitch, roll);


Should I just leave out the roll part?

D3DXQuaternionRotationYawPitchRoll(&newQ, yaw, pitch, 0);


But this one works better

D3DXQuaternionRotationYawPitchRoll(&newQ, yaw, 0, pitch);


Strange to it?

##### Share on other sites

IF you are using a physics engine, there will normally be a flag that you can set for this.

Otherwise, you need to manage this yourself.

For a vehicle constantly on the ground, you can actually just take the normal of the ground and use that to detemine how upright you are. To give some room to let it bounce and jolt, you'd want to place this under control of foces, but also apply a dampening mechanism to prevent the vehicle from suddenly flipping off into space.