![]() |
VR-Forces 4.0.4 Class Documentation
|
DtMissileCollisionActuator models collision of a missile with other entities or with the terrain. More...

Public Member Functions | |
| DtMissileCollisionActuator (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) | |
| (const DtString&,DtVrfObject*,DtSimManager*, | |
| virtual | ~DtMissileCollisionActuator () |
| destructor | |
| virtual bool | init () |
| to get access to the entity's localStateRepository, which this component | |
| virtual DtString | type () const |
| Returns a string identifies the class type of component. | |
| virtual void | tick () |
| Checks for collisions with entities or terrain. | |
| 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. | |
Static Public Member Functions | |
| static DtSimComponent * | creator (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) |
| (const DtString&,DtVrfObject*,DtSimManager*, | |
Protected Member Functions | |
| DtMissileCollisionActuator () | |
| Default constructor; should not be called. | |
| DtMissileCollisionActuator (const DtMissileCollisionActuator &orig) | |
| copy constructor; shallow copy - timers not copied | |
| const DtMissileCollisionActuator & | operator= (const DtMissileCollisionActuator &orig) |
| assignment operator; see comments on copy constructor! | |
Protected Attributes | |
| DtMissileStateRepository * | myMissileState |
| Dt3dBoundingVolume * | myCollisionBV |
| DtVector | myLastPosition |
| DtObjectId | myObjectId |
| bool | myStartPositionInited |
DtMissileCollisionActuator models collision of a missile with other entities or with the terrain.
End User Description: If the missile hits an entity, it will send a detonation. This actuator expects to be used by missile entities since it depends on the missile's state repository parameters.
Uses Descriptor Type: DtComponentDescriptor
| DtMissileCollisionActuator::DtMissileCollisionActuator | ( | 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 DtMissileCollisionActuator::~DtMissileCollisionActuator | ( | ) | [virtual] |
destructor
| DtMissileCollisionActuator::DtMissileCollisionActuator | ( | ) | [protected] |
Default constructor; should not be called.
Here because the compiler will generate an unprotected one otherwise.
| DtMissileCollisionActuator::DtMissileCollisionActuator | ( | const DtMissileCollisionActuator & | orig | ) | [protected] |
copy constructor; shallow copy - timers not copied
| virtual bool DtMissileCollisionActuator::init | ( | ) | [virtual] |
to get access to the entity's localStateRepository, which this component
will update, and then connect to the controller's ports. Also creates a collision bounding volume for the missile.
Reimplemented from DtActuatorComponent.
| virtual DtString DtMissileCollisionActuator::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 DtMissileCollisionActuator::tick | ( | ) | [virtual] |
Checks for collisions with entities or terrain.
If both occur, will determine which collision happened first.
Reimplemented from DtSimComponent.
| virtual DtVrfObject* DtMissileCollisionActuator::detectCollision | ( | double & | distToImpactSqrd, |
| DtVector & | detonLocationOut | ||
| ) | [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 DtMissileCollisionActuator::checkEntityForCollision | ( | DtVrfObject * | collidee, |
| const DtVector & | missilePath, | ||
| const DtVector & | missileBoxCenter, | ||
| DtVector & | detonLocationOut, | ||
| double & | distToImpactSqrd | ||
| ) | [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 DtMissileCollisionActuator::checkForGroundImpact | ( | double & | distToImpactSqrd, |
| DtVector & | impactPoint, | ||
| DtDetonationResult & | result | ||
| ) | [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 DtMissileCollisionActuator::sendDetonation | ( | DtVrfObject * | impactedEntity, |
| const DtVector & | detonLocation | ||
| ) | [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 DtMissileCollisionActuator::sendDetonation | ( | DtDetonationResult | result, |
| const DtVector & | collisionPt | ||
| ) | [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.
| static DtSimComponent* DtMissileCollisionActuator::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 DtMissileCollisionActuator& DtMissileCollisionActuator::operator= | ( | const DtMissileCollisionActuator & | orig | ) | [protected] |
assignment operator; see comments on copy constructor!
Dt3dBoundingVolume* DtMissileCollisionActuator::myCollisionBV [protected] |
DtVector DtMissileCollisionActuator::myLastPosition [protected] |
DtObjectId DtMissileCollisionActuator::myObjectId [protected] |