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

How to make projectile face direction of where it's traveling?

Asked by
obcdino 113
5 years ago
Edited 5 years ago

The script below fires an arrow from a crossbow, but the arrow doesn't face the way it's traveling. Does anyone know how to fix it?

tool = script.Parent
plr = game.Players.LocalPlayer
mouse = plr:GetMouse()

tool.Equipped:Connect(function()
    mouse.Button1Down:Connect(function()
    local p = Instance.new("Part", workspace)
    p.CanCollide = false
    p.Size = Vector3.new(1,1,1)
    p.Position = tool.Handle.Position
    tool.Mesh:Clone().Parent = p
    local bv = Instance.new("BodyVelocity", p)
    bv.Velocity = mouse.Hit.lookVector * 100
    end)
end)

1 answer

Log in to vote
0
Answered by 5 years ago

You could use lookVector once again to determine the orientation of the arrow. This method could take some experimenting. If the front of the arrow isnt actually the head, add 90 degrees on the x axis in the script.

Ad

Answer this question