How to make a Missile follow a path?
I am trying to make a nuclear missile that follow a path that is modeled like the projectile equation: h(t) = 16^2+vt+h. I also want the missile's orientation to follow the path as well. I have used a script found here: scriptinghelpers.org/blog/modeling-a-projectiles-motion The problem is that I can't really mess with how high the projectile goes without sending the projectile into space or completely missing the target.
02 | local mouse = game.Players.LocalPlayer:GetMouse(); |
03 | local hrp = game.Players.LocalPlayer.CharacterAdded:Wait():WaitForChild( "HumanoidRootPart" ); |
04 | local bball = script.Parent:WaitForChild( "Handle" ); |
06 | mouse.Button 1 Down:Connect( function () |
07 | local g = Vector 3. new( 0 , -game.Workspace.Gravity, 0 ); |
08 | local x 0 = hrp.CFrame * Vector 3. new( 0 , 2 , - 2 ) |
11 | local v 0 = (mouse.Hit.p - x 0 - 0.5 *g*t*t)/t; |
14 | local c = bball:Clone(); |
16 | c.CFrame = CFrame.new(x 0 ); |
18 | c.Parent = game.Workspace; |
It would be helpful to me if the variables included: Target Position and Speed as well as the recommended speed to go over 2000 studs