How to make fluid momentum and parkour

so yea, back working on my project
i coded most of the movement systems, including a really, really barebones momentum system
i want something that makes it so you can chain your movement together, and if that movement increase your speed, that speed carries on for some time until it slow down to the normal speed
i also wanted to make it so if youre at too high of a speed or youre in the air, it becomes harder for you to turn, not impossible, just take like half a second more so people trying to hit you dont have a hard time if you spam A and D
my current momentum system is horrible. well, not horrible, but not good for a game that focuses on 2 things: movement, and shooting

the current momentum system really just stores the default walkspeed of the player, and constantly checks if the HRP speed is faster than the current walkspeed, if it is, it changes the walkspeed to the HRP speed and applies a small decay, stopping the decay once the speed is below the stored value

2 Likes

I’m gonna summarize because I don’t feel like writing an essay. For momentum, you could use the LinearVelocity instance to apply your velocity and then smoothly reduce the velocity by decaying the value until it’s 0.

i thought about that, it could probably work. but then i started wondering, wouldnt it override the player’s walk direction or not really?

Walk direction? Are you talking about the MoveDirection property? Assuming its that, no it doesn’t. If the player doesn’t move it will remain 0,0,0

i mean let the player still change what direction its going, like, if i run forward and the momentum store that, but then i press to run to the other side, would it also start turning or would it keep running forward as if it was overriding my inputs?

Just set the velocity’s direction to the direction the humanoid root part is facing. But yes, if it is one constant direction then the character will not be able to move in any other directions

hm, alright ,thanks! gonna try coding that in

1 Like

I don’t have much experience with creating momentum based movement so take what I say here with a grain of salt.
You could try and store all the momentum / speed a player would experience in a single Linear Velocity Instance similar to what was mentioned above. Instead of creating new instances for different movement actions you would just add onto the base Linear Velocity Instance. I would imagine this would make it easier to manage a player’s speed and much easier to cause it to decay. You don’t have to do this however, multiple instances of Linear Velocity will still produce the same amount of force as their forces combined into a singular instance of Linear Velocity, and you can check a player’s total velocity via the AssemblyVelocity property. I’d just imagine one instance of Linear Velocity would be easier to manipulate than a dozen.

One thing I’d watch out for is remembering that the force Gravity has on velocity would not be represented in the Linear Velocity Instance and you’d have to check for that by subtracting the force applied on the Y axis in the Linear Velocity instance from the player’s assembly velocity’s Y axis.

i can just set the max force mode to perAxis and make the Y 0, so the default behaviour is kept while the horizontal momentum works correctly

yea this isnt working correctly, idk how to make it work normally but also take in consideration other impulses, like explosions or dashes

nevermind! i got it working and also adapting to impulses from other velocity constraints, it looks pretty good! thanks everyone for the help

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.