I’m trying to get the velocity of a vehicle, controlled by keyboard (WASD). I’ve implemented the following blueprint function.
GetVelocity returns a vector in the world space coordinates, so I’ve found the UnrotateVector function that gives the velocity in the vehicle space coordinates (or at least I believe that). Now, the resulting X value is ok (positive moving forward, negative moving backward), but I don’t underderstand the Y value, which I’ve interpreted as lateral velocity.
I would like to have a function that returns a positive value while I’m turning right, and a negative one while turning left. Now, instead, for example if I press W and D for a long time (circle trajectory turning right) the Y value assumes positive and negative values. I think it depends from the yaw rotation, but I don’t understand how.
Is there a way to do that?
Thank you a lot