How do I get the velocity of the humanoid root part?

I’m making a platformer game and my own system that gives the player in the game moves, and I want to make a long jump. So how would I get the humanoid root parts velocity?

HumanoidRootPart.AssemblyLinearVelocity

Just simple as that.

1 Like

So would I check the z axis of ALV if I want to make it so that the Forward velocity of the player is multiplied by their look vector to make a long jump?

1 Like
HumanoidRootPart.AssemblyLinearVelocity.Z

Since AssemblyLinearVelocity returns a Vector3, we can access the individual values and yes, check the -z for the forward velocity, positive is backward.

Ok, I’m facing an issue now. While playtesting, I noticed that in the properties of the root part, AssemblyLinearVelocity is always zero for each axis.

Are you moving while checking the velocity?

Yes.

Unless I change the value of the ALV, it doesn’t change at all.

Is the character unanchored or anchored?

unanchored, I wouldn’t be able to move if it wasn’t?

I found some weird behavior, if you print it manually using a script in a while loop, it prints the regular value, but in the properties, it just does not update the value.

Time to message Bug support again…

Well, thanks for the help. I’ll mark it as solution for now, because what your saying will most likely work when this is fixed.

It already works, it just doesn’t show up in the properties, you also might need to convert the Velocity value to the HumanoidRootPart’s objectspace.

What’s the object space? and Why does this matter?

LinearAssemblyVelocity is in worldspace, worldspace is pretty hard to explain, but let’s say were moving forward. Our position will change by -z, but let’s turn around to face backwards, but wait… Now it’s changing my position by z. That’s how worldspace works. Making the Velocity value Objectspace fixes this by making the Velocity value have its worldspace as the RootPart, so now orientation matters, and if you face forward and rotate in a “forward” direction then it will change -z.

HumanoidRootPart.Velocity

This works for any BasePart.

That is deprecated, GetVelocityAtPosition() or AssemblyLinearVelocity supersede that.

Hmm? I don’t think this was for me but I just saw this question and wrote this.

I got mixed up with the avatar

lol

1 Like

If you are not getting the velocity then can you try to calculate it yourself?

--Script in StarterCharacterScripts
local Character = script.Parent
local OldPosition = Vector3.zero

local st = tick()
while task.wait() do
	local dt = tick()-st
	st = tick()
	local HumanoidRootPart = Character.HumanoidRootPart
	local Velocity = (HumanoidRootPart.Position-OldPosition)/dt
	print(Velocity)
	OldPosition = HumanoidRootPart.Position
end