Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

I need some assistance with understanding velocity?

I've known how to make things go forwards with velocity since I started scripting...

object.Velocity = object.CFrame.lookVector *1234--random number which would move real fast

Is their any other way to do this to the left and right?

1 answer

Sure, the lookVector returns a direction facing the -z axis of the CFrame. You can use the components to return the other directional vectors (which may be the most efficient) or you can do this:

local objectCF = object.CFrame;
local rotation = objectCF - objectCF.p; -- We remove (subtract) position from the CFrame
local left = rotation * Vector3.new(-1, 0, 0); -- We multiply it by a Vector3 with -1 on the x-axis (which is left.)
object.Velocity = left * 1234;

3 comments

0

using rotation * Vector3.new(1, 0, 0) would be right?

0

Yes, or you can do left * -1234

0

Thanks

This discussion is preserved as it was. New answers, comments, and votes are closed.