Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Hexadotz |
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
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”.
Ox0zOwra | 2022-09-11 19:34
var velocity = vector3.Zero #or Vector3()
func example():
print(velocity)
#or
print(velocity.x)
#or
print(velocity.y)
#or
print(velocity.z)
ramazan | 2022-09-11 20:09