Hard to help without knowing what is happening vs what you want to happen, and why your equation is structured the way it is; what your motivations are for each line, what each variable represents.
Not sure how to explain it but airstrafing is when you turn your camera in the same direction as you movement keys while in the air.
Regular airstarfing requires to release W, but I want it to function ONLY when you are actively pressing W, as you would initially expect.
Not a good example, but this Roblox game has what I’m looking for.
See the keys pressed on the bottom right at the beginning of the vid.
your calculation here subtracts by speed_in_dir which is a dot product of velocity and dir, presumable the latter being a normalized input direction.
Thus if you are moving backwards you will recieve full air_accel, sideways will result in zero subtracted from air_speed/10 and holding forwards will subtract the length of velocity.
If you want to flip this you can change the subtraction to an addition.
var add_speed = clamp(air_speed/10 + speed_in_dir, 0, air_accel * delta)
Ok, i think its working, but cant tell becauase im going at supersonic speeds, if you have a fix, that would be well apreciated.
Having ZERO air_speed still makes me go rlly fast.
This is the code for dir: