MQ-9 Reaper Drone missile tracking issues

G’day! I’ve made a program that mimicks the behavior of an MQ-9 reaper drone.

In essence, the script grabs the local player’s camera and circles it around a designated part called the “OriginPart”

The script then enters a while loop where it highlights everyone it can see, and tells the camera to look at a part called “PointerPart”

Using WASD, you can move pointer part around the map, and thus rotate the camera.

Pressing Z when near a player will “Lock” onto that player (essentially PointerPart temporarily becomes their HRP until Z is pressed again, which will either unlock, or lock onto another player)

Q/E to zoom in and out,

Pressing Y turns on target designation mode for the Hellfire missiles.(this highlights the player, changes the sight picture, and allows you to fire hellfire missiles by clicking mousebutton1. I’ve also added a blur effect to the click to “simulate” the rocket being so close to the camera shaking it.

Video of the current functionalities of my program:
NOTE: the video is very laggy for some reason. this does not reflect game quality. It’s as smooth as butter.
robloxapp-20230607-1425171.wmv (1.9 MB)

streamable .com link: here

There are multiple issues that I wish to address about the project.

  1. The lack of tracking. If the player moves, the missile does not update and track them (I understand why in the code posted below, However this leads me into my second point)

  2. A better way of moving the missile model (i am currently using tweenservice. I know that using roblox physics would be a better alternative, not only that but using physics and CFrames should resolve the issue shown in the video where the rocket’s end position rotation is always the same, however I’ve got NO clue how to use them. this is my primary reason for posting)

  3. This is probably the most difficult, however I figured I’d ask. I want the missile to mimic the in flight trajectory of the real deal. which in most cases follows a similar curve to this:


    (red line is the drone’s height, red coordinate is the the position the drone dropped the rocket, (0,0) is the time the rocket activated, the blue line is the flight trajectory of the rocket, the purple line is the ground. the green dot is the target.

  4. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve looked at all sorts of solutions on the dev-hub. 99.9% of which deal with model following having a humanoid in it or some other jazz.
    More details:

Source Code for the rocket spawning


RS = game:GetService("ReplicatedStorage")
local RocketVelocity = 1600 -- studs/sec
local TweenService = game:GetService("TweenService")

function calcFlightDist(startpos,endpos)
	local delta = Vector3.new(math.abs(startpos.X - endpos.X), math.abs(startpos.Y - endpos.Y), math.abs(startpos.Z-endpos.Z))
	return delta
end

RS.HellFireSpawn.OnServerEvent:Connect(function(player, spawnPos,targetPos) 
-- I will be changing "targetPos" to "targetPart" so the current position of the part can be calculated within this function. this is part of the issue for not being able to track the player. 

	-- CALCULATING TIME for TWEENINFO
	local distance = calcFlightDist(spawnPos,targetPos)
	local studTime = distance.X + distance.Y + distance.Z -- ik this makes no sense. I'll fix it later
	print("Distance between the two parts is: "..tostring(distance))
	print("Calculated StudTime: ".. tostring(studTime))
	local flightTime = (studTime / RocketVelocity)
	print("Estimated time to impact: ".. tostring(flightTime))


	local rocketpath = TweenInfo.new(flightTime,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0.25)


	local rocket = RS["AGM-114 Hellfire"]:Clone()
	rocket.Parent = workspace
	rocket:move(spawnPos)
	local Goal = CFrame.new(targetPos)
	local CF_value = Instance.new("CFrameValue")
	CF_value.Changed:Connect(function(V)
		rocket:PivotTo(V)
	end)
	CF_value.Value = rocket:GetPivot()
	local FireRocket = TweenService:Create(CF_value,rocketpath,{Value = Goal})
	
	FireRocket:Play()
	
end)

I’m primarily looking for help on 1 and 2. if any of you math gods wish to take the challenge of simulating an irl missile then may mercy be upon your soul.

Thank you! :smiley:

If the target is moving the you need to use lerp to move the missile in a loop, which will cater for the moving target destination. The actual flight path can be calculated using bezier curves to give you a realistic trajectory.