–1 vote

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

Godot version 3.4.2
in Engine by (897 points)



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

1 Answer

0 votes

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.

by (7,743 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.