I am designing a simple controller for my player class, which is a simulated rigid body. What I want is to attach "thrusters" to the rigid body which can be manipulated by a throttle - so I want to apply the scaled force to the body in object space, so to say.
Since the applyForce method takes a force vector in world space, I have to transform my original vector.
I tried simply rotating the vector like this:
Code: Select all
btVector3 rotaxis(worldQuat.getX(), worldQuat.getY(), worldQuat.getZ());
if(rotaxis.length() > 0)
fvec = fvec.rotate(rotaxis, worldQuat.getW());
but this gives me the wrong result. I also tried other methods for rotating, as well as home-brew matrix code, but to no avail. By now this simple problem is eating my brain.
What is the right way of achieving the transform?