Bezier Curve not firing smoothly

Hello developers! My Bezier Curve works but for some reason, the projectile (I am making an artillery that fires exploding projectiles) which is a sphere would move irregularly to the finish point. (it would move up and down randomly and and make a zig zag pattern, it almost seems as it is teleporting) I don’t see anything wrong with my code is there something that I can fix to make the projectile launch smoothly? Thanks!

local button = script.Parent.Button.ClickDetector
local p1 = game.Workspace.p1.Position
local start = game.Workspace.Start.Position
local finish = game.Workspace.Finish.Position

function beizercurve()
	local travel = game:GetService("ReplicatedStorage").PartReplications.Travel:Clone()
	travel.Parent = game.Workspace 
	
	local function lerp(a, b, t)
		return a + (b - a) * t 
	end
	for i = 0,100,1 do
		local t = i/100
		local l1 = lerp(start,p1,t)
		local l2 = lerp(p1,finish,t)

		local quad = lerp(l1,l2,t)
		travel.Position = quad 
		wait(0.01)
	end
end

button.MouseClick:Connect(beizercurve)

Heres a video of the Bezier curve:

1 Like

Is it anchored? It’s a mistake a lot of people make. Also I suggest you look into parabolas. I made a module for this using this post, Modeling a projectile's motion, but I think you can use the post instead of the module.

2 Likes

Thank you very much that made the curve smooth however, for some reason the bomb wont explode when it detects collisions. Is there any way to solve this?

1 Like

You can use AssemblyLinearVelocity as shown in the basket ball example. Or raycasting if you still want to use cframes, but i suggest keeping the projectile unanchored and using velocity as its smoother and you can detect collision easier.

1 Like