Hello! So i made a cannon that the player can get into via a proximityprompt. Once the prompt is pressed, the player will be put inside the cannon & the HumanoidRootPart will be anchored, and the player will get launched to the destination part. The problem here is that i want the curve to go up, not left or right. I can’t figure out how to fix this, i’ve tried to play around with the Vector3 values but nothing’s changing. Below is the code, a video showing the problem and the model of the cannon.
local Character = Player.Character or Player.CharacterAdded:Wait()
local Root = Character:WaitForChild("HumanoidRootPart")
local function lerp(a, b, t)
return a + (b - a) * t
end
local function quadraticBezier(t, p0, p1, p2)
local l1 = lerp(p0, p1, t)
local l2 = lerp(p1, p2, t)
local quad = lerp(l1, l2, t)
return quad
end
Root.Anchored = true
Root.CFrame = self._Start.CFrame
for i = 1, 100 do
local t = i/100
local Updated = quadraticBezier(t, self._Start.Position, Vector3.new(0, 100, 0), self._End.Position)
Root.Position = Updated
task.wait()
end