Waiting for Data
Greetings, brave Tarkhan.
Decoded a radio message and uncertain about the next move? Fret not.
For a successful INTERCEPT, ensure you have the target's location relative to your position, their heading, their speed, and the course length they are currently traveling.
This is an intercept calculator for the video game HighFleet. Plug in data provided by radio decoded messages to calculate the intercept course.
The intercept course blends your bearing towards the target and the target's heading. This amalgamation helps in determining the optimal heading to successfully intercept the target.
Intercept Course = atan2((targetSpeed * sin(targetHeading)) + (maxSpeed * sin(targetBearing)),
(targetSpeed * cos(targetHeading)) + (maxSpeed * cos(targetBearing)))
The time to intercept is gauged by dividing the distance to the target by the closing speed. An additional check is done to determine if the interception is possible before the target reaches its destination.
Time to Intercept = targetDistance / closingSpeed
In scenarios where the desired time to intercept isn't provided, the distance is essentially the path you'd cover, considering your max speed and the time to intercept.
Distance to Intercept = maxSpeed * timeToIntercept
The required speed depends on the desired time to intercept. If provided, the speed needed to intercept the target within the specified time is calculated. An additional check is added to ensure the required speed doesn't exceed the maximum speed.
Required Speed = Distance to Intercept / desiredTimeToIntercept
Required Speed = Distance to Intercept / timeToIntercept (if desired time isn't specified)
The time it takes for the target to reach its destination is computed by dividing the target's course length by its speed. This is important as it ensures that the interception occurs before the target reaches its destination.
Time to Destination = targetCourseLength / targetSpeed
Remember, trigonometric functions in these formulas (like sin, cos, atan2) require angles in radians, not degrees. In the script, I've utilized helper functions to toggle between degrees and radians as necessary.