How can I get a velocity direction?

I’m trying to make a part face its velocity, like an arrow.
However I get prints like 0, -0.9999999403953552, 0. The part is hovering above the baseplate, and when I click run it falls to the ground. How can I make the part face where it is going (velocity)?

You can do something like

CFrame.lookAt(workspace.Part.Position, workspace.Part.Position + workspace.Part.LinearAssemblyVelocity)
1 Like

Something like this?

local part = --part

while task.wait() do
	part.CFrame = CFrame.lookAt(part.Position, part.Position * part.LinearAssemblyVelocity)
end

If say velocity = Vector3.new(0,0,0) then it will just look towards the world’s origin, so I’m not 100% sure if this would work. I may be wrong though. – edit also Velocity is deprecated, use LinearAssemblyVelocity instead :+1:

Ah, my bad. Didn’t know velocity was deprecated. But, if you did velocity = Vector3.new(0,0,0), it should look at the part’s position (not really sure what that would look like tbh)

1 Like

Good point, no idea either :sweat_smile: Although, im sure if an arrow stops moving it that means its reached its end.

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