Hi,
I already researched a lot but none of the solutions that i can find seem to work. The distance between p0 and p2 is decided by how far the MousePosition (p2) is away from p0. Yet, how would i make it so that, no matter what the distance is, it always takes the same time (say for example, 5 seconds) to get from p0 to p2?
function quadBezier(t, p0, p1, p2) return (1 - t)^2 * p0 + 2 * (1 - t) * t * p1 + t^2 * p2 end local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() local Character = Player.Character or Player.CharacterAdded:Wait() local speed = 50 Mouse.Button1Down:Connect(function() local p0 = Character.PrimaryPart.Position + Vector3.new(0,3,0) local p2 = Mouse.Hit.p local p1 = p0:Lerp(p2, .5) + Vector3.new(0,5,0) local snowball = workspace.snowball:Clone() snowball.Parent = workspace coroutine.wrap(function() for t = 0, 1, 1/100 do local newPos = quadBezier(t, p0, p1, p2) snowball.Position = newPos wait() end end)() end)
I'm trying to make a snowball. Thanks in advance!