Reddit man told me to go to Forums for help with Source movement

I’m using the most basic version of Quake air movement, BUT, I want to be able to Airstrafe while holding W.

func air(delta):
	#Gravity
	velocity.y -= gravity * delta
	#Airstrafing
	var speed_in_dir = velocity.dot(dir)
	var add_speed = clamp(air_speed/10 - speed_in_dir, 0, air_accel * delta)
	velocity += add_speed * dir

Maybe your dot product is working against that.

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.

(Post Deleted By Author)

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)
3 Likes

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:

	input_dir = Input.get_vector("left", "right", "up", "down").normalized()
	dir = transform.basis * Vector3(input_dir.x, 0, input_dir.y)

Might be affecting it.

Maybe your air_accel is really high, keep in mind the speed from this is un-capped, presumably added every frame.


You should not normalize get_vector it is already bound 0.0 to 1.0, you are removing controller support by re-normalizing it.

Kay, ig I’ll figure out how to cap speed.