Help on creating walking physics

So I’ve lately wondering on how to make walking “physics” like the games “Criminality” and “SoulShatters”

Example of what I’am trying to achieve:

Your HRP (Humanoid Root Part, from what I can guess) slightly moves left and right while walking, when turning you slow down and character has a small wind-up as you can see in the videos above. I’ve been trying to figure this for a while, so any answers/tips would be highly appreciated and would help me a lot!

1 Like

I am not exactly sure what you mean by “walking physics”. To clear this ambiguity:

  • Are you referring to the animations’ ability to smoothly transition whenever humanoid state changes?
  • Are you referring to the movement speed the character does? Also pay attention that the camera can fool the player from moving faster by increasing FOV.
  • Or what is it otherwise?

I believe you need to manipulate the camera as @Operatik said.

This could help but I have not done it myself.

As for the walking to sprint, are you holding shift or is it sprinting automatically after holding down a movement key for a certain amount of time? Both are fairly simple.

Holding down shift
Firstly use UserInputService to check when the player is holding down shift. On input began, create a for loop that increases player speed, and on input ended create another for loop to decrease player speed.

        for i = 1,10 do
			humanoid.WalkSpeed = humanoid.WalkSpeed + 1
			wait(.1)
		end

Auto Sprint
Firstly create a while loop that checks the humanoid’s magnitude to determine if they are moving or not. Then I create a for loop to increase the walkspeed by 1 every 10th of a second.

if humanoid.MoveDirection.Magnitude > 0 then	-- Moving
         wait(1) -- However long you want the player to input before sprinting
	     -- for loop to increase player walkspeed over time.
elseif humanoid.MoveDirection.Magnitude <= 0 then	-- Stopped moving
	     -- setting walkspeed back to original speed
end
3 Likes

Your HRP (Humanoid Root Part, from what I can guess) slightly moves left and right while walking, when turning you slow down and character has a small wind-up

I believe he was talking about the character moving to the side when turning.
The solution possibly could be checking if the player is holding A/D (and not in a menu/chat), then checking if the player is above a set velocity and then finally doing what you want.

Smarter way would be to check the velocity of the characters sides and then do stuff from there instead of the mentioned A/D holding key check, you do whatever you want. Hope I didn’t confuse you, I can explain everything I mentioned in detail with code examples if the OP wants.

1 Like

I’m talking about the HRP or Torso slightly going left and right possibly with CFrame, and not just the animation, but anything Is appreciated so If you know anything of that I’d like some code examples or just a tip on how to do it! That Is mainly what I’m trying to figure out.

1 Like