http://youtu.be/8R92hvQLALA
Here's the code I'm using to apply the forces:
(LeftStick and RightStick control the engine rotation around the X axis, LeftAnalog and RightAnalog control the engine strength)
Code: Select all
btTransform Transform;
VTOL->rigid_body->getMotionState()->getWorldTransform(Transform);
btMatrix3x3 Basis = Transform.getBasis();
btQuaternion LeftQuaternion(btVector3(1, 0, 0), LeftStick * deg_to_rad(EngineMaxAngle));
btQuaternion RightQuaternion(btVector3(1, 0, 0), RightStick * deg_to_rad(EngineMaxAngle));
btVector3 LeftForceVector = btVector3(0, LeftAnalogValue * EngineMaxForce, 0);
btVector3 RightForceVector = btVector3(0, RightAnalogValue * EngineMaxForce, 0);
LeftForceVector = btMatrix3x3(LeftQuaternion) * LeftForceVector;
RightForceVector = btMatrix3x3(RightQuaternion) * RightForceVector;
LeftForceVector = Basis * LeftForceVector;
RightForceVector = Basis * RightForceVector;
float Offset = .4f;
VTOL->rigid_body->applyForce(LeftForceVector, btVector3(-Offset, 0, 0));
VTOL->rigid_body->applyForce(RightForceVector, btVector3(Offset, 0, 0));
VTOL->rigid_body->setActivationState(1);