Introduction to Controlled Flight for Unity through examples and modeling of real world scenarios. Each major feature is explained in simple examples.

All basic functionality is done by using the MissileSupervisor component. Setup for use always starts by adding it to a GameObject. MissileSupervisor requires a RigidBody and will add it if not already added.

For detailed information see other pages on this website. The Script Reference contains a short description of each setting. Also in the Unity Editor each setting is explained in its tooltip.

Support and help can be requested with controlledflight@sparsedesign.com or support form. We will help with initial setup.

Basic Example

See video below for setup of a missile and target. The missile uses default settings and the target flies according along two waypoints.

Introduction tutorial

Target setup

The target is using path following.

For the target two waypoint objects are created and moved into place. Note that there is not reason for the waypoint objects to have a shape or collider, although it can be practical to see them at setup. A collider is not recommended since the target may collide with it when following the path.

Target Type is set to PATH and Path type is set as OBJECTS, and then the waypoint objects are input into Path Objects field. The target is moved to a place just by the first waypoint. This is not necessary, since the missile will navigate to the path anyway.

All other settings are left at default, which includes having a constant speed of 1 m/s.

Controlled Flight - Tutorial Target Setup
Controlled Flight – Tutorial Target Setup

Missile setup

The missile needs only one thing setup after the Target Type is set to TARGET: the target game object is dragged into the Target field. Everything else uses default settings, which means Proportional Navigation as Guidance Algorithm.

Controlled Flight - Tutorial Missile Setup
Controlled Flight – Tutorial Missile Setup

Speed Control

Expanding on the above example, by adding changes in speed control. See Launch and speed control for more info.

Launch mode changed to CUSTOMDIRECTION, in this case “north”, i.e. along the z-axis ([0, 0, 1]).

Launch speed is set to 1 m/s, to have an initial speed when launched. Two motor stages are used, acceleration and then “coast”, where no control of speed is applied.

The final speed is launch speed + acceleration for 2 seconds (1 + 1 * 2 =3 m/s).

Controlled Flight - Tutorial Speed
Controlled Flight – Tutorial Speed

This result in the behavior below. The movement is straight up and then it turns to the left, the target. The launch speed and acceleration for 2 seconds is not obvious but is there.

Modelling a Surface to Air missile

Lets model the famous Stinger missile using available data. Data that is not available is guessed and/or approximated. The data used:

DataValue
Weight10.1 kg
Max Flight time17 s
Guidance MethodProportional Navigation
Motor2 stage. Launcher and Booster then coast.
LauncherSpeed leaving the tube unknown.
Set to 20 m/s as a guess.
BoosterMach 2.2 (748 m/s) in 2 seconds
Drag coefficient (Cd)Unknown.
Set to 0.02. Often a good approximation.
Drag reference areaUnknown.
Set to 0.2. This can be completely wrong…
Navigation constant (N)Unknown.
Set to 4.
Max maneuver Unknown, but the data says it can follow a target doing 8 g.
Using proportional navigation the missile typically must manage more than N times the target.
Set to 4*8 g=32 g≅300 m/s²
Stinger missile data

From these data the followings settings can be used:

  • Rigidbody mass: 10.1
  • Guidance algorithm: PN
  • Navigation Constant: 4
  • Limit Maneouvre: 300
  • Limit flight time: 17
  • Missile dynamics: false. This can be used for better modeling.
  • Bank-to-turn : false (typically not done for smaller missiles)
  • Intercept Properties ignored for the purpose of this.
  • Automatic launch. true.For this purpose, change if needed.
  • Launch speed: 20. This simulates the first stage, that launches the missile from the tube.
  • # Stages: 2. There is one motor stage (ignoring launch which is done with launch speed) but for the coast stage another is added.
  • Stage 1 (Booster)
    • Motor Type: CONSTANTTHRUST
    • Limit time: 2 s
    • Guidance blocked: false. The missile is guided continuously.
    • Thrust: To reach Mach 2.2 in 2 s for a 10.1 kg:
      2.2* Speed of sound * 10.1 kg/2. But this does not take into account drag and missile weight reduction due to motor propellant use. Adding 10% as an approximation:
      2.2*340* 10.1*1.1/2≅4155
    • Reference Area: 0.2
    • Drag Cd: 0.02
  • Stage 2 (Coast)
    • Motor Type: NOTHRUST
    • Limit time: false
    • Guidance blocked: false. The missile is guided continuously.
    • Reference Area: 0.2
    • Drag Cd: 0.02

Drag data is constant since the missile doesn’t change shape or drop the boost motor.

Introduction to Controlled Flight - Stinger Model in Missile Supervisor
Stinger Model in Missile Supervisor

Result

This result in the following missile speed. Data logged from Unity.

Stinger speed profile
Stinger speed profile (click to expand)

This seems reasonable from the available data. Tweaks can be done and details can be added of course, but for this purpose it looks pretty good. For example, there could be a short coast stage between launch and boost ignition.

Below is a video of the missile intercepting a target traveling at 300 m/s at launch distance 3000 m.

Note that the missiles maneuvers after the first turn towards intercept point. This is because its closing speed varies over time which is a factor in the algorithm. In short, the missile speed is low in the beginning which means it overcompensates, and chooses an intercept point too far forward. But of course it compensates and intercept the target.

Fighter Jet shooting AA missiles

Below is an example where a fighter is carrying a number of missiles and launches them towards a target. Is created with the included Launcher functionality.

This is simply achieved with the Launcher component, see included example scene. For more advanced use see Advanced use.

Fighter launches AA missiles towards target