Hi want to create a smooth arc projectile using bezier curves.
I have an idea of using body velocities or positions with tweens but can’t seem to figure it out.
function lerp(a, b, c)
return a + (b - a) * c
endfunction CubicBezier(t, p0, p1, p2, p3)
local l1 = lerp(p0, p1, t)
local l2 = lerp(p1, p2, t)
local l3 = lerp(p2, p3, t)
local a = lerp(l1, l2, t)
local b = lerp(l2, l3, t)
local cubic = lerp(a, b, t)return cubic
end
for t = 0, 1, .001 do
BezierPosition = CubicBezier(t, SaveHumanoidRootPartPos, HitBox.Position, HitBox3.Position, HitBox2.Position)
end–[[local BodyPosition = Instance.new(“BodyPosition”)
BodyPosition.position = BezierPosition
BodyPosition.maxForce = Vector3.new(50000, 50000, 50000)
BodyPosition.P = 25000
BodyPosition.Parent = Effectlocal TweenData = TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out, 0, false, 0)
local Tween = TweenService:Create(BodyPosition,TweenData,{Position = BezierPosition})
Tween:Play()]]