![]() |
VR-Forces 4.0.4 Class Documentation
|
DtWeaponActuator is a simple model of a ballistic gun. More...

Public Member Functions | |
| DtWeaponActuator (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) | |
| (const DtString&,DtVrfObject*,DtSimManager*, | |
| virtual | ~DtWeaponActuator () |
| destructor | |
| virtual bool | init () |
| to get access to the entity's localStateRepository, which this component will update, and then connect to the controller's ports. | |
| virtual DtString | type () const |
| Returns a string identifies the class type of component. | |
| virtual void | tick () |
| Fire if requested. | |
| virtual bool | postAddComponentsInit () |
| Overridden to initialize the value on myArtPartTypePort. | |
| virtual void | fireTheWeapon () |
| Calls createFireInteraction() and sends the resulting DtFireInteraction through the exercise connection. | |
| virtual DtFireInteraction * | createFireInteraction () |
| Creates and fills out a DtFireInteraction. Returns a DtFireInteraction. | |
| virtual void | setProjectileStartSpeed (DtReal startSpeed) |
| virtual DtReal | projectileStartSpeed () |
| virtual void | setMuzzleOffset (const DtVector &muzzleOffset) |
| virtual const DtVector & | muzzleOffset () |
| virtual const DtVector & | muzzleLocalPosition () |
| Returns the weapon muzzle’s position in local coordinates. | |
| virtual const DtDcm & | weaponOrientation () |
| Returns the rotation matrix needed to rotate a vector from body coordinates of the weapon to local coordinates. | |
| virtual DtArticulatedPartStateRepository * | getWeaponSimBody () |
| Looks up the DtSimBody* for the weapon in the entity’s state repository. | |
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 | |
| virtual bool | createPortGroups () |
| Creates the local port groups. | |
| virtual bool | createPorts () |
| Creates the input ports and adds them to the component. | |
| virtual bool | createPSR () |
| Creates #myProcessState data member, and adds it to our process state repository manager. | |
| DtWeaponActuator () | |
| default constructor; not implemented | |
| DtWeaponActuator (const DtWeaponActuator &orig) | |
| copy constructor; not implemented | |
| const DtWeaponActuator & | operator= (const DtWeaponActuator &orig) |
| assignment operator; not implemented | |
Protected Attributes | |
| DtWeaponActuatorDescriptor * | myWeaponActuatorDescriptor |
| DtEntityIdentifier | myObjectId |
| DtReal | myProjectileStartSpeed |
| DtVector | myMuzzleOffset |
| DtVrfObject * | myCurrentEntityTarget |
| These are set by createFireInteraction and used by createDetonationInteraction. | |
| DtEventId | myCurrentEventId |
| DtReal | myCurrentRange |
| DtVrfWeaponPSR * | myWeaponProcessState |
Ports and Port Groups | |
| DtInputPortGroup * | myWeaponInputPortGroup |
| Input Port Group Name: weapon-control Input Port Group Description: | |
| DtAmmunitionInputPort * | myAmmunitionPort |
| Input Port Name: ammunition Input Port Description: Type of ammo to fire. | |
| DtConstrainedIntegerInputPort * | myFusePort |
| Input Port Name: fuze Input Port Description: DIS Enumeration for fuze (see DIS Enumeration and Bit Encoded Values document for values). | |
| DtBooleanInputPort * | myTriggerPort |
| Input Port Name: trigger Input Port Description: True to fire. | |
| DtBooleanInputPort * | myLoadedPort |
| Input Port Name: loaded Input Port Description: True if loaded. | |
| DtOutputPortGroup * | myWeaponOutputPortGroup |
| Output Port Group Name: weapon-info Output Port Group Description: | |
| DtIntegerOutputPort * | myArtPartTypePort |
| Output Port Name: art-part-type Output Port Description: Type of the articulated part. | |
DtWeaponActuator is a simple model of a ballistic gun.
End User Description: It can be given ammo to load, and the command to fire. It creates a fire interaction and preps a detonation interaction at the appropriate time. A derived type of this component, the DtLauncherActuator is used to simulate missile launchers in VR-Forces.
The weapon actuator provides a generic model of a ballistic gun. The indirect fire actuator and launcher actuator are children of the weapon actuator. It accepts ammunition type, load status, and trigger inputs. When the actuator is fired, it creates and sends a fire interaction. Because the weapon actuator does not prepare and send a detonation interaction as part of the firing process, the ballistic gun actuator may be a more appropriate choice for some situations (the ballistic gun actuator determines the detonation result of munition using probability tables, and generates the detonation interaction.).
Uses Descriptor Type: DtWeaponActuatorDescriptor
| DtWeaponActuator::DtWeaponActuator | ( | 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 DtWeaponActuator::~DtWeaponActuator | ( | ) | [virtual] |
destructor
| DtWeaponActuator::DtWeaponActuator | ( | ) | [protected] |
default constructor; not implemented
| DtWeaponActuator::DtWeaponActuator | ( | const DtWeaponActuator & | orig | ) | [protected] |
copy constructor; not implemented
| virtual bool DtWeaponActuator::init | ( | ) | [virtual] |
to get access to the entity's localStateRepository, which this component will update, and then connect to the controller's ports.
Calls createPSR() to creat e
Reimplemented from DtActuatorComponent.
Reimplemented in DtLauncherActuator.
| virtual DtString DtWeaponActuator::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.
Reimplemented in DtIndirectFireActuator, and DtLauncherActuator.
| virtual void DtWeaponActuator::tick | ( | ) | [virtual] |
| virtual bool DtWeaponActuator::postAddComponentsInit | ( | ) | [virtual] |
Overridden to initialize the value on myArtPartTypePort.
Reimplemented from DtSimComponent.
| virtual void DtWeaponActuator::fireTheWeapon | ( | ) | [virtual] |
Calls createFireInteraction() and sends the resulting DtFireInteraction through the exercise connection.
Reimplemented in DtIndirectFireActuator, and DtLauncherActuator.
| virtual DtFireInteraction* DtWeaponActuator::createFireInteraction | ( | ) | [virtual] |
Creates and fills out a DtFireInteraction. Returns a DtFireInteraction.
Reimplemented in DtIndirectFireActuator.
| virtual void DtWeaponActuator::setProjectileStartSpeed | ( | DtReal | startSpeed | ) | [virtual] |
| virtual DtReal DtWeaponActuator::projectileStartSpeed | ( | ) | [virtual] |
| virtual void DtWeaponActuator::setMuzzleOffset | ( | const DtVector & | muzzleOffset | ) | [virtual] |
| virtual const DtVector& DtWeaponActuator::muzzleOffset | ( | ) | [virtual] |
| virtual const DtVector& DtWeaponActuator::muzzleLocalPosition | ( | ) | [virtual] |
Returns the weapon muzzle’s position in local coordinates.
It calls getWeaponSimBody() to get the DtSimBody associated with the weapon. If no DtSimBody part is found for the weapon, it returns the local position of the entity. If it is found, it calls DtSimBody::calculateMeInWorld() to get the position of the weapon in local coordinates. It rotates the muzzle offset (stored by the entity in body coordinates in myMuzzleOffset) by the weapon’s current orientation (a rotation matrix returned by weaponOrientation()), to get the offset in local coordinates. It then adds the offset to the weapon’s local position to get the muzzle position in local coordinates, and returns.
| virtual const DtDcm& DtWeaponActuator::weaponOrientation | ( | ) | [virtual] |
Returns the rotation matrix needed to rotate a vector from body coordinates of the weapon to local coordinates.
It looks up the DtSimBody associated with the weapon by calling getWeaponSimBody(). If it finds the DtSimBody, it returns the rotation matrix given by the DtSimBody::calculateMeToWorld(). If it does not find the DtSimBody, it calls DtEuler_to_BodyToLocalRef() with the entity’s local orientation, and returns the resulting matrix instead.
| virtual DtArticulatedPartStateRepository* DtWeaponActuator::getWeaponSimBody | ( | ) | [virtual] |
Looks up the DtSimBody* for the weapon in the entity’s state repository.
It first looks up the articulated part type specified in the component’s articulated part descriptor list. If it finds the articulated part type, it tries to look up the DtSimBody in the entity’s state repository, using the articulated part type as a key. If it finds DtSimBody, it returns a pointer to the DtSimBody, if it does not, it returns NULL.
| static DtSimComponent* DtWeaponActuator::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). |
Reimplemented in DtIndirectFireActuator, and DtLauncherActuator.
| virtual bool DtWeaponActuator::createPortGroups | ( | ) | [protected, virtual] |
Creates the local port groups.
Reimplemented from DtSimComponent.
| virtual bool DtWeaponActuator::createPorts | ( | ) | [protected, virtual] |
Creates the input ports and adds them to the component.
Reimplemented from DtSimComponent.
Reimplemented in DtIndirectFireActuator, and DtLauncherActuator.
| virtual bool DtWeaponActuator::createPSR | ( | ) | [protected, 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.
Reimplemented in DtIndirectFireActuator.
| const DtWeaponActuator& DtWeaponActuator::operator= | ( | const DtWeaponActuator & | orig | ) | [protected] |
assignment operator; not implemented
DtInputPortGroup* DtWeaponActuator::myWeaponInputPortGroup [protected] |
Input Port Group Name: weapon-control
Input Port Group Description:
DtAmmunitionInputPort* DtWeaponActuator::myAmmunitionPort [protected] |
Input Port Name: ammunition
Input Port Description: Type of ammo to fire.
Input Port Range:
Input Port Default Value:
Input Group Parent: weapon-control
Input Port Name: fuze
Input Port Description: DIS Enumeration for fuze (see DIS Enumeration and Bit Encoded Values document for values).
Input Port Range:
Input Port Default Value:
Input Group Parent: weapon-control
DtBooleanInputPort* DtWeaponActuator::myTriggerPort [protected] |
Input Port Name: trigger
Input Port Description: True to fire.
Input Port Range:
Input Port Default Value:
Input Group Parent: weapon-control
DtBooleanInputPort* DtWeaponActuator::myLoadedPort [protected] |
Input Port Name: loaded
Input Port Description: True if loaded.
Input Port Range:
Input Port Default Value:
Input Group Parent: weapon-control
Output Port Group Name: weapon-info
Output Port Group Description:
DtIntegerOutputPort* DtWeaponActuator::myArtPartTypePort [protected] |
Output Port Name: art-part-type
Output Port Description: Type of the articulated part.
See the DIS Enumeration and Bit Encoded Values document for values.
Output Port Range:
Output Port Default Value:
Output Group Parent: weapon-info
DtEntityIdentifier DtWeaponActuator::myObjectId [protected] |
DtReal DtWeaponActuator::myProjectileStartSpeed [protected] |
DtVector DtWeaponActuator::myMuzzleOffset [protected] |
DtVrfObject* DtWeaponActuator::myCurrentEntityTarget [protected] |
These are set by createFireInteraction and used by createDetonationInteraction.
DtEventId DtWeaponActuator::myCurrentEventId [protected] |
DtReal DtWeaponActuator::myCurrentRange [protected] |
DtVrfWeaponPSR* DtWeaponActuator::myWeaponProcessState [protected] |