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.
|Target Direction||Tracking and launch is done towards the target or the first waypoint in a path.|
|Vertical||Tracking and launch is done vertically, i.e. in the positive global y-direction.|
|Custom Direction||Tracking and launch towards a custom vector.||Launch Direction: launch vector (global coordinate system).|
|Object Rotation||Mimics the rotation of a provided object.||Object: A game object from which the rotation is taken.|
|Object||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.|
|None||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.
The speed can also be controlled in stages (see Multistage Rocket). Note that only one stage can be active at any moment. Parallel staging can be emulated with intermediary stages
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.
|Constant Speed||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²]
|Constant acceleration||Note that the acceleration can be negative.||Acceleration [m/s²]|
|Constant Thrust||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)
|NoThrust||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:
Drag=Cd*A*⍴*v²/2 Cd: Drag coefficient A: Reference Area ⍴: Density of air v: speed
⍴ 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.