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?
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?
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;
This discussion is preserved as it was. New answers, comments, and votes are closed.
3 comments
using rotation * Vector3.new(1, 0, 0) would be right?
Yes, or you can do left * -1234
Thanks