Turning a part's velocity (world space) into relative local space?

Trying to do some stuff with the player’s movement direction and CFrame, how would I take the player’s velocity relative to the HumanoidRootPart’s lookvector and translate that so that the direction is translated into local space? (-z means the player moving forward for example)

Sorry if this is explained poorly.

2 Likes

I think what you’re looking for is vectorToObjectSpace?

Example usage:

local relativeVelocity = rootPart.CFrame:vectorToObjectSpace(velocity)
19 Likes

That’s a very handy function. Thank you!

oh NEAT that’ll be handy thanks

1 Like