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.
local t = 1; local mouse = game.Players.LocalPlayer:GetMouse(); local hrp = game.Players.LocalPlayer.CharacterAdded:Wait():WaitForChild("HumanoidRootPart"); local bball = script.Parent:WaitForChild("Handle"); mouse.Button1Down:Connect(function() local g = Vector3.new(0, -game.Workspace.Gravity, 0); local x0 = hrp.CFrame * Vector3.new(0, 2, -2) -- calculate the v0 needed to reach mouse.Hit.p local v0 = (mouse.Hit.p - x0 - 0.5*g*t*t)/t; -- have the ball travel that path local c = bball:Clone(); c.Velocity = v0; c.CFrame = CFrame.new(x0); c.CanCollide = true; c.Parent = game.Workspace; end)
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