|
VR-Engage
2.2
|
DtTopAndDirectAttackMissileController models the movement of a Javelin missile along a path to its target, supporting two different attack modes:
Each mode has different flight phases, and the controller manages transitions between phases based on altitude, distance to target, and attack angles.
#include <topAndDirectAttackMissileController.h>
Public Member Functions | |
| DtTopAndDirectAttackMissileController (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) | |
| virtual | ~DtTopAndDirectAttackMissileController () override |
| virtual const char * | type () const override |
| virtual void | preFirstTickInit () override |
| virtual void | setTargetEntity (const DtUUID &entity) override |
| virtual DtSimObjectReference | targetEntity () const override |
| virtual void | calculateSteering (const DtVector &relativeVelocity, const DtVector &localPosition, const DtVector &targetVelocity, const DtVector &targetPoint, double &maneuverAccelXOut, double &maneuverAccelYOut, double &maneuverAccelZOut) override |
| virtual void | processTargetPointTask (DtSimMessage *msg) override |
Public Member Functions inherited from makVre::DtVreSimComponent< DtMissileMoveToControllerComponent > | |
| DtVreSimComponent (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) | |
| virtual | ~DtVreSimComponent () |
| bool | isPlayerControlled (const std::string &role="") const |
| DtString | entitySystemName () const |
Static Public Member Functions | |
| static void | targetPointCallback (DtSimMessage *msg, void *usr) |
| static DtSimComponent * | creator (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) |
Protected Member Functions | |
| DtTopAndDirectAttackMissileController () | |
| DtTopAndDirectAttackMissileController (const DtTopAndDirectAttackMissileController &orig) | |
| const DtTopAndDirectAttackMissileController & | operator= (const DtTopAndDirectAttackMissileController &orig) |
| virtual void | registerTaskMsgCallbacks () override |
| virtual bool | setupControlPoint () override |
| virtual DtVector | calculateClimbOutPoint () |
| virtual bool | reachedClimbOutAltitude () |
| virtual DtVector | calculateAltitudeHoldPoint () |
| virtual bool | reachedTerminalAngleToTarget () |
| virtual DtVector | calculateTerminalPoint () |
| virtual makVre::DtVreMessageResult | handleUpdateMissileTarget (makVre::DtVreMessage *msg) |
| virtual void | lookupAndCacheProcessSR () override |
| virtual void | processObjectAdded (const DtLocalObject *simObject) |
Static Protected Member Functions | |
| static void | objectAddedCallback (const DtLocalObject *simObject, void *usr) |
Protected Attributes | |
| DtSimObjectReference | myTargetPointer |
| bool | myLookupWarningSent |
| DtTopAndDirectMissileFlightPSR * | myVreMissileFlightPSR |
| DtTopAndDirectAttackMissileControllerDescriptor * | myTopAndDirectAttackMissileControllerDescriptor |
| double | myClimbOutAngle |
| double | myTerminalAngle |
| double | myMaxAltitude |
| bool | myCallbackAdded |
| makVre::DtTopAndDirectAttackMissileController::DtTopAndDirectAttackMissileController | ( | const DtString & | name, |
| DtLocalObject * | owner, | ||
| DtSimulationServices * | simManager, | ||
| DtComponentDescriptor * | desc = 0, | ||
| DtReaderWriterRegistry * | parentRegistry = 0 ) |
Constructor.
| name | The name of this component |
| owner | The local object that owns this component |
| simManager | The simulation services manager |
| desc | Component descriptor with configuration parameters |
| parentRegistry | Optional parent registry for reader/writer functionality |
Creates a new top and direct attack missile controller component with the specified parameters.
Referenced by DtTopAndDirectAttackMissileController(), and operator=().
|
overridevirtual |
Virtual destructor.
Cleans up resources used by the top and direct attack missile controller component.
|
protected |
Default constructor (protected, not for direct use)
This constructor is protected and not meant to be called directly. It exists because the compiler would otherwise generate an unprotected one.
|
protected |
Copy constructor (protected, performs shallow copy)
| orig | The original object to copy from |
Performs a shallow copy operation that does not copy the ports. This constructor is protected and not meant for general use.
References DtTopAndDirectAttackMissileController().
|
overridevirtual |
Gets the type identifier for this component.
Implements the DtSimComponent::type() method to return the type identifier for this component.
|
overridevirtual |
Performs initialization before the first simulation tick.
Gets the missile attack mode (top-attack or direct-attack) from the entity's extended data and sets it in the process state repository. Also caches the appropriate flight parameters based on the selected mode.
|
overridevirtual |
Sets the target entity that the missile should fly to.
| entity | UUID of the target entity |
Sets the target entity the missile should fly to. The flight path will depend on the current attack mode (top-attack or direct-attack). The trajectory is not direct but follows the phases defined for the selected mode.
|
overridevirtual |
Gets the currently set target entity.
Returns a reference to the entity currently set as the missile's target.
|
overridevirtual |
Calculates steering parameters to guide the missile to target.
| relativeVelocity | Relative velocity vector between missile and target |
| localPosition | Current position of the missile |
| targetVelocity | Velocity vector of the target |
| targetPoint | Target position vector |
| maneuverAccelXOut | Output parameter for X-axis maneuver acceleration |
| maneuverAccelYOut | Output parameter for Y-axis maneuver acceleration |
| maneuverAccelZOut | Output parameter for Z-axis maneuver acceleration |
Overrides the base class implementation to calculate steering parameters for guiding the missile along its multi-phase flight path to the target. Updates the output acceleration parameters to achieve the desired trajectory.
|
static |
Static callback function for target point messages.
| msg | The simulation message containing the target point information |
| usr | User data pointer (contains the controller instance) |
Static function registered as a callback to handle target point messages. Instances of this component register this callback with their own 'this' pointer as user data with the message executive to receive notification of move-to tasks.
|
overridevirtual |
Processes a target point task message.
| msg | The simulation message containing the target point task |
Extracts the target entity information from the DtTargetPointTask message and calls setTargetEntity() with the UUID of the specified target entity.
|
static |
Factory method to create a new instance of this component.
| name | The name for the new component |
| owner | The local object that will own this component |
| simManager | The simulation services manager |
| desc | Optional component descriptor |
| parentRegistry | Optional parent registry for reader/writer functionality |
Static factory method used by the component creation system to instantiate new instances of this component type.
|
protected |
Assignment operator (protected, performs shallow copy)
| orig | The original object to assign from |
Performs a shallow assignment operation similar to the copy constructor. This operator is protected and not meant for general use.
References DtTopAndDirectAttackMissileController().
|
overrideprotectedvirtual |
Registers message callbacks for handling task messages.
Registers the callback targetPointCallback() for handling DtTargetPointTask messages sent to this missile controller.
|
overrideprotectedvirtual |
Sets up the current control point for missile guidance.
Determines the appropriate working target point based on the current flight phase (climb-out, altitude-hold, or terminal) and then calls setTargetPoint() to update the missile's guidance system.
|
protectedvirtual |
Calculates the endpoint for the climb-out flight phase.
Determines the position that marks the end of the climb-out phase based on the current missile position, target position, and configured climb-out angle.
|
protectedvirtual |
Checks if the missile has reached its climb-out altitude.
Compares the missile's current altitude with the configured climb-out altitude to determine if the missile should transition to the next flight phase.
|
protectedvirtual |
Calculates the control point for the altitude-hold flight phase.
Returns a position directly above the target at the maximum altitude configured for the missile. This point is used for guidance during the altitude-hold phase of top-attack mode.
|
protectedvirtual |
Checks if the missile has reached the terminal angle to target.
Calculates the inclination angle from the target to the missile and determines if it has reached the configured terminal angle, indicating that the missile should transition to the terminal phase of flight.
|
protectedvirtual |
Calculates the endpoint for the terminal flight phase.
Determines the position of the target entity, accounting for any movement during flight. This is the final aim point for the missile during the terminal phase of flight.
|
protectedvirtual |
Moves the missile's target waypoint based on the VRE message. Waypoint will have its position updated or be attached to a target entity. Processes UpdateMissileTargetMessage events. This message can either set the target to a new location or an entity.
|
overrideprotectedvirtual |
Retrieves and caches the missile flight process state repository.
Looks up the missile flight process state repository and caches it for efficient access during simulation updates. The PSR contains the state information for the missile's flight phases and attack mode.
|
staticprotected |
This callback is necessary to make sure the handleUpdateMissileTarget callback is registered in the main thread. It needs to be registered in that thread because the sim's component worker threads don't tick the DtVreMessageManager.
|
protectedvirtual |
|
protected |
Reference to the current target entity.
Reference to the current target entity that the missile is tracking. This is updated each frame by the setupControlPoint() method.
|
protected |
Flag to prevent repeated warning messages.
When true, prevents the component from repeatedly sending 'failed to find target' warnings to the log. Ensures that warning messages are only sent once per missile instance.
|
protected |
Cached pointer to the missile flight process state repository.
Cached pointer to the derived type of process state repository used to store missile flight state information. This avoids repeated lookups and type casting during the missile's flight.
|
protected |
Cached pointer to the component descriptor.
Cached pointer to the derived type of component descriptor that contains configuration parameters specific to this missile controller. This allows efficient access to configuration settings without repeated type casting.
|
protected |
Cached climb-out angle for the current attack mode.
The angle used during the climb-out phase of flight. This value is set in preFirstTickInit() based on the attack mode and remains constant for the lifetime of the missile.
|
protected |
Cached terminal angle for the current attack mode.
The angle used to determine transition to the terminal phase of flight. This value is set in preFirstTickInit() based on the attack mode and remains constant for the lifetime of the missile.
|
protected |
Cached maximum altitude for the current attack mode.
The maximum altitude the missile should reach during flight. This value is set in preFirstTickInit() based on the attack mode and remains constant for the lifetime of the missile.
|
protected |