Speed Control is done in a section of the MissileSupervisor component. “Launch, speed and motor properties”.
The speed can be controlled in a very simple way but also simulate multi-stage rockets with varying properties and detailed modeling of thrust and drag.
|Tracking and launch is done towards the target or the first waypoint in a path.
|Tracking and launch is done vertically, i.e. in the positive global y-direction.
|Tracking and launch towards a custom vector.
|Launch Direction: launch vector (global coordinate system).
|Mimics the rotation of a provided object.
|Object: A game object from which the rotation is taken.
|Tracking and launch is done towards a provided game object. Note the difference with “Target Direction”, where the target is used.
|Object: A game object that that tracking is down towards.
|No tracking is done. Can be used with some external tracking functionality.
If checked the tracking sequence is started when The Start() method is called.
Tracking Time [seconds]
The time from start of tracking sequence to launch. Note that this is approximate and the accuracy depends on frame rate since it uses WaitForSeconds.
Valid for when tracking sequence is used, see Script Reference.
Speed control settings
The speed of the object can be controlled in a number of ways with varying detail. The speed can be controlled directly, the speed can be controlled by acceleration as well as the most realistic way: controlling thrust.
Each stage can be of a different type from the others and the transition between stages is done either by time or external scripts (using MissileSupervisor.SetStageNo())
This gives the object an instant speed boost at the moment of launch.
The motor stages controls the speed during the lifetime of that stage. Below are the different types of control.
|Keeps the speed constant.
Note that the acceleration limit (if active) still limits speed change when transitioning between stages. Setting the limit to zero preserves the initial speed.
Limit Acceleration [m/s²]
|Note that the acceleration can be negative.
|Provides a constant force/thrust. This thrust, minus optimal drag, provides an acceleration.
The mass of the object (in the rigibody) has an effect on the acceleration/speed.
Drag (see below)
|No thrust or acceleration is affecting the object. Note that drag still can have an effect.
|Drag (see below)
Constant speed will force the object to a specific speed. This speed may not be achieved instantaneously if there is an acceleration limit.
Constant acceleration should be self explanatory, it applies a constant change to the speed.
Constant thrust provides a constant propulsion force (F) that together with the drag (D) results in an acceleration (a) on the mass (m) of the rigidbody. This acceleration becomes: a=(F-D)/m
Limit Time [seconds]
This is how long the stage is active until it automatically transitions to the next stage. Note that if the there is no next stage nothing will happen at time limit.
This disable the missile guidance, i.e. the missile will not maneuver. This can be used to simulate powerful boost stages that do not allow maneuvers (typical in surface-to-air missiles).
Drag is calculated with the typical simple Drag equation:
Cd: Drag coefficient
A: Reference Area
⍴: Density of air
⍴ can be set in the ThrustControl class.
If applicable an expected speed will be calculated and displayed. This is the speed at which the thrust and drag is equal (but opposite), and which the speed eventually will converges towards.
If the drag is activated the drag in the Rigidbody is deactivated. The Unity drag model can be used, just deactivate the drag here and set Drag > 0 in the rigidbody.
More advanced drag calculations can be seen used. See here.