Hello there,
Is there a way to get the 3 velocities of a RigidBodyControl in the local directions x, y and z? In other words:
If I have a block with dimensions (10, 1, 2), how can I get the velocity in x, y and z, in relation to the blocks local axis, regardless of its rotation? I want the component of the velocity in the 10-unit direction, as well as the velocity in the 1-unit and 2-unit direction.
myShipsPhysics.getLinearVelocity() does give the x, y and z component in World, but not local to the controls axes. I have tried something like:
[java]speedVector.set(myShipsPhysics.getPhysicsRotation().normalizeLocal().mult(myShipsPhysics.getLinearVelocity()));
[/java]and then use speedVector.x or .y or .z but it’s not succesfull. I have the feeling this should be the way to go, but just don’t know how exactly.
Setting the myShipsPhysics.setApplyPhysicsLocal(true) does work, but entirely screws up the rest of my code and also requires more nodes and more work on having the additional parent node follow the myShipsPhysics. Either I do something wrong with this, or it is just not the way to go :-?
Anyway, if there is an easy way of getting the local velocity components, I would be very happy!