![]() |
VR-Forces 4.0.4 Class Documentation
|
DtWarheadDetonationActuator is an actuator that simulates the detonation for any type of warhead that may detonate upon impact with another entity, the ground, or the water. More...

Public Member Functions | |
| DtWarheadDetonationActuator (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) | |
| (const DtString&,DtVrfObject*,DtSimManager*, | |
| virtual | ~DtWarheadDetonationActuator () |
| destructor | |
| virtual bool | init () |
| Overridden to cache a pointer to the entity's radio in this class. | |
| virtual bool | registerRadioMessageCallbacks () |
| Registers for DtSetWarheadInfo messages. | |
| virtual bool | createPSR () |
| Creates myProcessState data member, and adds it to our process state repository manager. | |
| virtual void | setComponentDescriptor (DtComponentDescriptor *componentDescriptor) |
| Overridden to get the DtWarheadDetonationActuatorDescriptor. | |
| virtual DtString | type () const |
| Returns a string identifies the class type of component. | |
| virtual void | tick () |
| Checks for any collisions, and creates detonation if they are detected. | |
| virtual void | processWarheadInfoCallback (DtSimMessage *msg) |
| Processes an incomming SetWarheadInfo message by setting the fuze, warhead, attacker ID, and event ID. | |
Static Public Member Functions | |
| static void | setWarheadInfoCallback (DtSimMessage *msg, void *usr) |
| Static callback function which calls use->processWarheadInfoCallback(). | |
| static DtSimComponent * | creator (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) |
| (const DtString&,DtVrfObject*,DtSimManager*, | |
Protected Member Functions | |
| virtual bool | createPorts () |
| Called by init to create the input ports. | |
| virtual bool | checkArmed () |
| Returns true if the warhead is armed and capable of detonating. | |
| virtual bool | checkTrigger () |
| virtual bool | checkProximityDetonate () |
| If there is currently a proximity target and distance set in the PSR, this function checks to see if the current position is within the proximity detonate distance of the target. | |
| virtual void | checkMissileDetonation () |
| Impacting missiles are treated differently given their kinematic charateristics. | |
| virtual DtVrfObject * | detectCollision (double &distToImpactSqrd, DtVector &detonLocationOut) |
| Looks for possible entities for impact, and calls checkEntityForCollision when it finds a candidate. | |
| virtual bool | checkEntityForCollision (DtVrfObject *collidee, const DtVector &missilePath, const DtVector &missileBoxCenter, DtVector &detonLocationOut, double &distToImpactSqrd) |
| Checks to see if we've impacted with an entity. | |
| virtual bool | checkForGroundImpact (double &distToImpactSqrd, DtVector &impactPoint, DtDetonationResult &result) |
| All parameters are "out" params. | |
| virtual void | sendDetonation (DtVrfObject *impactedEntity, const DtVector &detonLocation) |
| Creates, fills out, and sends a DtDetonation interaction as a result of an entity collision. | |
| virtual void | sendDetonation (DtDetonationResult result, const DtVector &collisionPt) |
| Creates, fills out, and sends a DtDetonation interaction for terrain impacts using the given DtDetonationResult. | |
| virtual void | destroyAndRemoveEntity () |
| Called from tick() after either a detonation or impact has been detected. | |
Protected Attributes | |
| DtBooleanInputPort * | myTriggerInputPort |
| Input Port Name: trigger Input Port Description: Checks to see if the trigger was set. | |
| DtVrfObjectStateRepository * | myStateRep |
| Dt3dBoundingVolume * | myCollisionBV |
| DtVector | myLastPosition |
| bool | myStartPositionInited |
| DtWarheadDetonationActuatorPSR * | myProcessState |
| Container for state data associated with this component. | |
| DtWarheadDetonationActuatorDescriptor * | myWarheadDescriptor |
| DtEventId | myEventId |
| DtVrfObject * | myTargetObject |
| This is here for performance -- the real target is specified by the name in the PSR. | |
| bool | myNeedToDisplayTargetNotFoundWarning |
| Flag to indicate we need to display a warning message for target not found condition. | |
| bool | myAmMissile |
| Flag to let us know this is a missile and hence collision impacts will be treated differently from non missile warheads. | |
Private Member Functions | |
| DtWarheadDetonationActuator () | |
| Default constructor; should not be called. | |
| DtWarheadDetonationActuator (const DtWarheadDetonationActuator &orig) | |
| copy constructor; shallow copy - timers not copied | |
| const DtWarheadDetonationActuator & | operator= (const DtWarheadDetonationActuator &orig) |
| assignment operator; see comments on copy constructor! | |
DtWarheadDetonationActuator is an actuator that simulates the detonation for any type of warhead that may detonate upon impact with another entity, the ground, or the water.
End User Description: It monitors for collisions between the entity on which it is mounted and any of the applicable surfaces (ground, water, other entities). When a collision is detected, it will create a detonation. This actuator can be associated with any vrfObject that can detonate. For example, this actuator is used for representing IED--improvised explosive devices.
Parameters can be supplied to the warhead through the setWarheadInfo set data request, including Attacker ID, Event ID, Warhead and Fuze type. If an attacker ID is specified, collisions with the attacker entity will not be reported as entity collision.
Warhead will check for a firepower kill of its parent entity when it collides with something. If it has been firePowerKilled, no detonation is created.
Uses Descriptor Type: DtWarheadDetonationActuatorDescriptor
| DtWarheadDetonationActuator::DtWarheadDetonationActuator | ( | const DtString & | name, |
| DtVrfObject * | owner, | ||
| DtSimManager * | simManager, | ||
| DtComponentDescriptor * | desc = 0, |
||
| DtReaderWriterRegistry * | parentRegistry = 0 |
||
| ) |
(const DtString&,DtVrfObject*,DtSimManager*,
| name | Reader writer name of this component. |
| owner | The DtVrfObject that owns this component |
| simManager | The simulation manager (provides access to terrain, message interface, simulation clock). |
| desc | The component descriptor used to initialize this component. |
| parentRegistry | Pointer to the parent reader writer registry (the containing object that reads/writes this object). |
| virtual DtWarheadDetonationActuator::~DtWarheadDetonationActuator | ( | ) | [virtual] |
destructor
| DtWarheadDetonationActuator::DtWarheadDetonationActuator | ( | ) | [private] |
Default constructor; should not be called.
Here because the compiler will generate an unprotected one otherwise.
| DtWarheadDetonationActuator::DtWarheadDetonationActuator | ( | const DtWarheadDetonationActuator & | orig | ) | [private] |
copy constructor; shallow copy - timers not copied
| virtual bool DtWarheadDetonationActuator::init | ( | ) | [virtual] |
Overridden to cache a pointer to the entity's radio in this class.
Reimplemented from DtActuatorComponent.
| virtual bool DtWarheadDetonationActuator::registerRadioMessageCallbacks | ( | ) | [virtual] |
Registers for DtSetWarheadInfo messages.
| virtual bool DtWarheadDetonationActuator::createPSR | ( | ) | [virtual] |
Creates myProcessState data member, and adds it to our process state repository manager.
Passes in the name and type specified in the component descriptor (if they exist) to the DtVrfProcessStateRepository::createRepository factory method. If name and/or type is not specified, uses the appropriate default strings defined in procSRTypes.h.
| virtual void DtWarheadDetonationActuator::setComponentDescriptor | ( | DtComponentDescriptor * | componentDescriptor | ) | [virtual] |
Overridden to get the DtWarheadDetonationActuatorDescriptor.
Reimplemented from DtSimComponent.
| virtual DtString DtWarheadDetonationActuator::type | ( | ) | const [virtual] |
Returns a string identifies the class type of component.
Type values are defined in compTypes.h. DtSimComponent creation functions are registered with the DtSimComponentFactory using the type values as the key.
Reimplemented from DtSimComponent.
| virtual void DtWarheadDetonationActuator::tick | ( | ) | [virtual] |
Checks for any collisions, and creates detonation if they are detected.
Reimplemented from DtSimComponent.
| virtual bool DtWarheadDetonationActuator::createPorts | ( | ) | [protected, virtual] |
Called by init to create the input ports.
Reimplemented from DtSimComponent.
| virtual bool DtWarheadDetonationActuator::checkArmed | ( | ) | [protected, virtual] |
Returns true if the warhead is armed and capable of detonating.
This returns true if the firepowerKilled appearance bit is false for the parent entity.
| virtual bool DtWarheadDetonationActuator::checkTrigger | ( | ) | [protected, virtual] |
| virtual bool DtWarheadDetonationActuator::checkProximityDetonate | ( | ) | [protected, virtual] |
If there is currently a proximity target and distance set in the PSR, this function checks to see if the current position is within the proximity detonate distance of the target.
If so returns true. Otherwise return false.
| virtual void DtWarheadDetonationActuator::checkMissileDetonation | ( | ) | [protected, virtual] |
Impacting missiles are treated differently given their kinematic charateristics.
| virtual DtVrfObject* DtWarheadDetonationActuator::detectCollision | ( | double & | distToImpactSqrd, |
| DtVector & | detonLocationOut | ||
| ) | [protected, virtual] |
Looks for possible entities for impact, and calls checkEntityForCollision when it finds a candidate.
Iterates through the list of physical entities in the DtVrfObjectManager. For each test entity, it performs a rough exclusion check by computing a ‘miss radius’ and eliminating the entity if it lies outside of a test radius equal to the ‘miss radius’ plus the entity’s bounding volume radius. The miss radius is a distance between the missile’s position in the previous frame (myLastPosition) and its current position. If the test entity is within this test radius, it calls checkEntityForCollision() to determine if an actual collision took place. As soon as a call to checkEntityForCollision() returns true, the pointer to the entity involved in the collision is returned. If no entities meet the criteria for collision, the function returns 0.
| virtual bool DtWarheadDetonationActuator::checkEntityForCollision | ( | DtVrfObject * | collidee, |
| const DtVector & | missilePath, | ||
| const DtVector & | missileBoxCenter, | ||
| DtVector & | detonLocationOut, | ||
| double & | distToImpactSqrd | ||
| ) | [protected, virtual] |
Checks to see if we've impacted with an entity.
Tests whether the missile intersects with the bounding volume of a target entity. A chord, defined by the position of the missile in the previous frame (myLastPosition) and the current missile position, is tested to see if it intersects with the bounding volume of the target entity. The test is made by calling Dt3dBoundingVolume::intersectsLineOfChord(), in the target entity’s bounding volume member. If intersectsLineOfChord() returns true, the distance to the impact location is returned in a function call parameter, and the checkEntityForCollision() returns true. If not, it returns false.
| virtual bool DtWarheadDetonationActuator::checkForGroundImpact | ( | double & | distToImpactSqrd, |
| DtVector & | impactPoint, | ||
| DtDetonationResult & | result | ||
| ) | [protected, virtual] |
All parameters are "out" params.
A return of true means there was an impact and the out values are all valid. Tests for the intersection of the missile with the terrain. Specifically, it checks to see if a chord formed by the position the missile in the previous frame (myLastPosition) and the current missile position, intersects with the terrain skin. It calls DtSimTerrain::groundIntersection() to make this test. If that function returns true, it computes the distance to the impact and sets the detonation result type to DtDetResGroundImpact (both items are returned in function call parameters), and returns true. If groundIntersection() returns false, it does some additional checking to see if it flew off or under the terrain database. It checks to see if the missile lies outside of a bounding box encompassing the terrain database. If so, it sets the impact point to the location of the missile, sets the detonation result type to DtDetResAirBurst, and returns true. If the missile has not intersected with the terrain skin and it has not left the database, the function returns false.
| virtual void DtWarheadDetonationActuator::sendDetonation | ( | DtVrfObject * | impactedEntity, |
| const DtVector & | detonLocation | ||
| ) | [protected, virtual] |
Creates, fills out, and sends a DtDetonation interaction as a result of an entity collision.
This method also forces an update of the missile at the location of the impactedEntity. The detonation itself is created at detonLocation.
| virtual void DtWarheadDetonationActuator::sendDetonation | ( | DtDetonationResult | result, |
| const DtVector & | collisionPt | ||
| ) | [protected, virtual] |
Creates, fills out, and sends a DtDetonation interaction for terrain impacts using the given DtDetonationResult.
This method also forces an update of the missile at the collisionPt.
| virtual void DtWarheadDetonationActuator::destroyAndRemoveEntity | ( | ) | [protected, virtual] |
Called from tick() after either a detonation or impact has been detected.
Sets the parent entity to destroyed and queques it for removal from the simulation.
| static void DtWarheadDetonationActuator::setWarheadInfoCallback | ( | DtSimMessage * | msg, |
| void * | usr | ||
| ) | [static] |
Static callback function which calls use->processWarheadInfoCallback().
| virtual void DtWarheadDetonationActuator::processWarheadInfoCallback | ( | DtSimMessage * | msg | ) | [virtual] |
Processes an incomming SetWarheadInfo message by setting the fuze, warhead, attacker ID, and event ID.
| static DtSimComponent* DtWarheadDetonationActuator::creator | ( | const DtString & | name, |
| DtVrfObject * | owner, | ||
| DtSimManager * | simManager, | ||
| DtComponentDescriptor * | desc = 0, |
||
| DtReaderWriterRegistry * | parentRegistry = 0 |
||
| ) | [static] |
(const DtString&,DtVrfObject*,DtSimManager*,
| name | Reader writer name of this component. |
| owner | The DtVrfObject that owns this component |
| simManager | The simulation manager (provides access to terrain, message interface, simulation clock). |
| desc | The component descriptor used to initialize this component. |
| parentRegistry | Pointer to the parent reader writer registry (the containing object that reads/writes this object). |
| const DtWarheadDetonationActuator& DtWarheadDetonationActuator::operator= | ( | const DtWarheadDetonationActuator & | orig | ) | [private] |
assignment operator; see comments on copy constructor!
Input Port Name: trigger
Input Port Description: Checks to see if the trigger was set.
Input Port Range:
Input Port Default Value: false
Dt3dBoundingVolume* DtWarheadDetonationActuator::myCollisionBV [protected] |
DtVector DtWarheadDetonationActuator::myLastPosition [protected] |
Container for state data associated with this component.
This state is saved and restored as part of a scenario (or checkpoint).
DtEventId DtWarheadDetonationActuator::myEventId [protected] |
DtVrfObject* DtWarheadDetonationActuator::myTargetObject [protected] |
This is here for performance -- the real target is specified by the name in the PSR.
We don't want to look up that name every tick.
Flag to indicate we need to display a warning message for target not found condition.
Only needs to be displayed once. Displaying every time its ticked can generate a slew of warnings in the console.
bool DtWarheadDetonationActuator::myAmMissile [protected] |
Flag to let us know this is a missile and hence collision impacts will be treated differently from non missile warheads.