So I am using the standard CharacterBody3d movement script for my player.
I was wondering how I could set a walking variable to true whenever I start moving.
The player movement looks like this:
Looks pretty good, except wouldn’t you do equivalent when checking on the first one, not you wouldn’t use less than because the player could move backwards.
Actually there already is a variable that tells you if the player is walking or not.
if direction: Here you check if he should move or not.
If you don’t press any of your input directions this will be a Vector3(0,0,0), meaning no direction, so not moving.
Or if you prefer you could create a seperate variable outside any functions and update it inside your movement function: