Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add air_velocity for handling the players movement in the air. #37

Open
SirLich opened this issue Dec 1, 2024 · 0 comments
Open

Add air_velocity for handling the players movement in the air. #37

SirLich opened this issue Dec 1, 2024 · 0 comments

Comments

@SirLich
Copy link

SirLich commented Dec 1, 2024

This is without feature flags (I removed some because I didn't need them), but splitting acceleration from when you're in the air Vs. on the ground is a good way to give more control:

	if is_on_floor():
		velocity.x = lerp(velocity.x, direction.x * speed, acceleration * delta)
		velocity.z = lerp(velocity.z, direction.z * speed, acceleration * delta)
	else:
		velocity.x = lerp(velocity.x, direction.x * speed, air_acceleration * delta)
		velocity.z = lerp(velocity.z, direction.z * speed, air_acceleration * delta)

I can submit a PR if you think this is a good addition (of course, it will still respect the existing flags for motion smoothing etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant