Hi. I have an actor with a physical body. I apply forces to it and I want to “simulate” drag. I tried to getLinearVelocity, transform it into actors coordinates, *modify it, transform it back, and setLinearVelocity back.
This afaik completely works, if I modify it as a whole (lerp to (0,0,0) vector).
But when I try to lerp x, y, z with different rates, it works only if I don’t spin my ship. When I try to spin more aggressively, I am able to completely change my direction (more than 90° - which should be impossible).
Blue arrow is the original linear velocity, the red/green arrow is the current linear velocity. This is how it is supposed to work all the time:
You can see how it reduces local Y velocity and keeps local X velocity. (Video 20-30s here https://youtu.be/p-MFSjqyUEI?t=20)
But when I heavily rotate (and only with different values per axis), I am pretty easily able to produce ‘impossible’ state:
It should be impossible to reduce the blue vector to the red one, yet this happens.
My code is this (box is the root of the actor) and works if I set all the alphas to the same value:
(yaw control here):
You can see the problems in the video here, at 50s mark: https://youtu.be/p-MFSjqyUEI?t=50
I’ve tried pretty much everything I could think of, but I didn’t solve it yet. Could anyone help me, please? I struggle with it for quite some time now, which is why I have that ground texture, these arrows etc. I am unable to understand why this keeps happening.