Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Projectile use lookVector for Velocity?

Asked by 5 years ago

I'm trying to make a projectile use the aimed direction to shoot a projectile. I tried doing this

potato.CFrame = CFrame.new(potato.CFrame.Position,plr.Character:FindFirstChild("HumanoidRootPart").CFrame.lookVector)
        potato.Velocity = Vector3.new(-exitforce,0,0)

but it does not work. How would I do this? The idea of the script excerpt was to make the look Vector point forward and use the X-axis to shoot it forward.

Basically: How do I shoot a projectile at a certain speed at a certain direction (direction is dictated by the CFrame.Angles() of the character and speed is by a variable)

0
I recommend using bodymovers due to lag issues, lookvector may work, but it's not the best option here User#20388 0 — 5y
0
Also you could use remoteevents to reduce the projectile lag seith14 206 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

You can use BodyGyro to change direction, and BodyVelocity separately to do this. Funny thing is I just started with a plane that measures forward velocity relative to the part's cframe. Anyway, I set my bodygyro cframe by: BodyGyroName.CFrame = CFrame.new(Vector3.New(), --[[ LookAt position]] and you could do BodyVelocityName.Velocity= Vector3.New(Part.CFrame.LookVector.X*-exitforce,Part.CFrame.LookVector.Y*-exitforce,Part.CFrame.LookVector.Z*-exitforce) for the speed.

Ad

Answer this question