How to tell if a vehicle is going forwards or backwards?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By SteveSmith

Title says it all really. How can I tell if my vehicle is going forwards or backwards? The linear_velocity only gives its speed.



ramazan | 2022-09-02 12:14

Thanks! Do I feel stupid. I assumed the linear_velocity was always positive.

SteveSmith | 2022-09-02 12:46

:bust_in_silhouette: Reply From: Inces

You could get your object TRANSFORM basis and compare it to velocity vector by using dot product dot , but I am sure You would be able to extract this information much easier from your input code. You must have coded some conditions when vehicle drives forward or backward, just use them.