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

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

I don’t even know how tick works at all…

Or how this script works.

the above code will print the selected HRP’s .Y velocity every stepped, should help you get started

1 Like

Could you explain how the line of code that uses Vector3.new()and .Magnitude gives you the velocity of the player’s Y axis?

Vector3 is essentially a 3d vector, the worldspace has X, Y, Z axis in a 3d space.

.Magntiude is just a linear alg calculation, it simplifies the given vector into a integer/double value which is the velocity value you need to be using

HRP.AssemblyLinearVelocity.Y is the given velocity vector of Y at the given point

So in this case, if I wanted to get one part to bounce perfectly to get to another part, would I use ApplyImpulse onto the part that I want to get to the target part and use the magnitudes value to multiply it to the part that I want to get to the target?

Seems a little more complicated,

Applying Impulse on the player character may need a large value for the y axis due to the weight of the character. you’ll have to experiment yourself

1 Like

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