0 votes

The title says it all but for more context i want to know if the player is moving forward or backward no Matter which direction they look at

Godot version 3.5
in Engine by (57 points)

You can have a variable hold the direction of the player (e.g. 0 means forward, 1 means moving right, 2 means moving backwards, 3 means moving to the left etc.), then have that direction change whenever you press a key (e.g. W for forward would set direction to 0 in this case). The variable that holds the direction doesn't even have to do anything, in fact, you can just have it hold information that will only be useful to you.

It's really up to you to define what counts as "moving forward".

var velocity = vector3.Zero #or Vector3()

func example():

1 Answer

+1 vote

If You coded movement somehow, You should have enough information to recognize direction. Velocity can be negative. If this doesn't solve it, how is your movement handled than ?

by (7,925 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.