I have been trying to create an Artillery model, for that I was browsing the devforum to see if there was any code/resource on projectile motion.
I found the following:
local i = 0 local x0 = launch.Position local g = Vector3.new(0, -game.Workspace.Gravity, 0) local v0 = (enemy.Position - x0 - 0.5*g*t*t)/t game:GetService("RunService").Heartbeat:Connect(function(step) if not (i >= 1) then i = i + step projectile.CFrame = CFrame.new(0.5*g*i*i + v0*i + x0) end end)
This is what it does currently
It works well and all, but the projectile isn’t launched at angle; which is what I have been trying to solve.
Are there any physics/maths related resources you guys can recommend for me to learn from?