Last active
June 29, 2022 13:28
-
-
Save rosskarchner/d651abe7fb3c507e0ff0ba17f25b1155 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func _integrate_forces(state): | |
# enforce min and max speed | |
# based on: https://godotengine.org/qa/44040/how-to-set-a-max-speed-of-a-rigidbody2d?show=44086#c44086 | |
# no, I don't totally understand the math | |
state.linear_velocity=state.linear_velocity.normalized()*clamp(state.linear_velocity.length(), 700, 1000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment