|
VR-Engage
2.2
|
DtHumanGunJoyActuator provides a model of a handheld gun/weapon that can be controlled via joystick inputs.
Component Type: human-gun-Joystick-actuator
Descriptor Class: DtHumanGunActuatorDescriptor, Type: vre-human-gun-actuator-descriptor
#include <humanGunJoyActuator.h>
Classes | |
| struct | DtFireResult |
Public Member Functions | |
| DtHumanGunJoyActuator (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) | |
| virtual | ~DtHumanGunJoyActuator () override |
| virtual bool | init () override |
| virtual const char * | type () const override |
| virtual void | tick () override |
Public Member Functions inherited from makVre::DtVreSimComponent< DtBallisticGunJoy > | |
| 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 |
Public Member Functions inherited from makVre::DtBallisticGunJoy | |
| DtBallisticGunJoy (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc, DtReaderWriterRegistry *const parentRegistry=0) | |
| virtual | ~DtBallisticGunJoy () override |
| virtual void | setComponentDescriptor (DtComponentDescriptor *descriptor) override |
| virtual DtReal | setTarget (makVrf::DtArticulatedPartStateRepository *rotBody) |
| virtual makVrfEvents::DtFireEvent * | manualFireInteraction (makVrf::DtArticulatedPartStateRepository *rotBody) |
| virtual makVrfEvents::DtDetonationEvent * | manualDetonationInteraction (makVrf::DtArticulatedPartStateRepository *rotBody, DtReal &detTime, DtReal dist) |
| virtual DtUUID | targetSelection (makVrf::DtArticulatedPartStateRepository *rotBody, DtReal &dist) |
| virtual DtReal | distanceToTarget () |
Static Public Member Functions | |
| static DtSimComponent * | creator (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) |
Static Public Member Functions inherited from makVre::DtBallisticGunJoy | |
| static void | detonationCallback (DtTimer *timer) |
| static DtSimComponent * | creator (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) |
Protected Member Functions | |
| virtual bool | createPSR () override |
| virtual makVre::DtVreMessageResult | handleFireInput (makVre::DtVreMessage *msg) |
| virtual bool | aimGunElevation () |
| virtual bool | createPorts () override |
| virtual bool | aimGun () override |
| virtual void | getFireResult (const DtVector &shooterPosition, const DtTaitBryan shooterOrienation, DtFireResult &fireResult) |
| virtual makVrfEvents::DtFireEvent * | createFireInteraction (const DtVector &firingPosition, const DtTaitBryan firingOrientation) |
| virtual makVrfEvents::DtDetonationEvent * | createDetonationInteraction (const DtVector &firingPosition, const DtTaitBryan firingOrientation, const DtFireResult &fireResult, DtReal &detTime) |
| virtual void | depleteResource (int amount=1) |
| virtual void | setRestored () |
| virtual bool | allowWeaponFiring () |
| virtual makVre::DtVreMessageResult | fire () |
| virtual DtTaitBryan | recoilEffect (DtVector worldShooterPosition, DtTaitBryan worldShooterOrientation) |
| DtHumanGunJoyActuator () | |
| DtHumanGunJoyActuator (const DtHumanGunJoyActuator &orig) | |
| const DtHumanGunJoyActuator & | operator= (const DtHumanGunJoyActuator &orig) |
Protected Attributes | |
| DtVreHumanGunActuatorDescriptor * | myHumanGunDescriptor |
| DtRwInt * | myFirepowerHealth |
| int | myBurstRoundsRemaining |
| DtEntityType | myTriggerMunition |
| DtVector | myTriggerWorldPosition |
| DtTaitBryan | myTriggerWorldOrientation |
| DtHumanLocalObjectFacade | myHumanLocalObjectFacade |
| bool | myPlayerControlled |
| DtVreMunitionLoader * | myVreMunitionLoader |
Ports and Port Groups | |
| DtAnalogInputPort * | myAimAzimuthInputPort |
Protected Attributes inherited from makVre::DtBallisticGunJoy | |
| bool | myReportedNoArticulation |
| DtConstrainedAnalogInputPort * | myElevationPort |
| DtBooleanInputPort * | myActiveJoystickPort |
| makVre::DtHumanGunJoyActuator::DtHumanGunJoyActuator | ( | 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 human gun joystick actuator component with the specified parameters.
Referenced by DtHumanGunJoyActuator(), and operator=().
|
overridevirtual |
Virtual destructor.
Cleans up resources used by the human gun joystick actuator component.
|
protected |
Default constructor (not implemented)
Default constructor is private and not implemented to prevent creation of instances without proper initialization.
|
protected |
Copy constructor (not implemented)
Copy constructor is private and not implemented to prevent copy construction.
References DtHumanGunJoyActuator().
|
overridevirtual |
Initializes the component.
Performs component initialization, setting up message handlers for fire input and initializing internal state for weapon operation.
|
overridevirtual |
Gets the type identifier for this component.
Implements the DtSimComponent::type() method to return the type identifier for this component.
Reimplemented from makVre::DtBallisticGunJoy.
|
overridevirtual |
Updates the component state each simulation frame.
Checks for transitions to/from player control. Upon taking control as a player, disables thresholding of ammo counts (clip state properties) to ensure the most accurate information possible for display in the HUD. Upon leaving player control, restores thresholding of ammo counts to reduce network load for CGF entities that don't require the same degree of precision.
Reimplemented from makVre::DtBallisticGunJoy.
|
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.
|
overrideprotectedvirtual |
Creates the process state repository for this component.
Creates the process state repository for this component and adds it to the process state repository manager. Uses the name and type specified in the component descriptor if they exist, otherwise uses appropriate default strings defined in procSRTypes.h.
|
protectedvirtual |
Processes fire input messages.
| msg | Pointer to the fire input message |
Handles FireInputMessage sent from role logic (human, tank, etc.) and updates myTriggerMunition, myTriggerWorldPosition, and myTriggerWorldOrientation parameters used for rapid fire in the tick function.
|
protectedvirtual |
Aims the gun in elevation.
Adjusts the gun's elevation based on input port values or pre-calculated values.
|
overrideprotectedvirtual |
Creates input and output ports for this component.
Creates the required input and output ports for this component, particularly the azimuth aiming port specific to the human gun actuator.
Reimplemented from makVre::DtBallisticGunJoy.
|
overrideprotectedvirtual |
Aims the gun based on input port values.
Aims the gun based on input port values. Uses the myAimElevationInputPort to determine the correct elevation and the myAimAzimuthInputPort to determine the correct azimuth, combining them to aim the weapon appropriately.
|
protectedvirtual |
Calculates the result of firing the weapon.
| shooterPosition | The position of the shooter in world coordinates |
| shooterOrienation | The orientation of the shooter in world coordinates |
| fireResult | Output parameter to store the fire result data |
Performs the ballistic calculations to determine what happens when the weapon is fired from the given position and orientation.
|
protectedvirtual |
Creates a fire event to send to the simulation.
| firingPosition | The position from which the weapon is fired |
| firingOrientation | The orientation of the weapon when fired |
Creates a fire event interaction based on the firing position and orientation, which will be sent to the simulation to notify other components about the firing.
|
protectedvirtual |
Creates a detonation event to send to the simulation.
| firingPosition | The position from which the weapon was fired |
| firingOrientation | The orientation of the weapon when fired |
| fireResult | Result data from the fire calculation |
| detTime | Output parameter to store the detonation time |
Creates a detonation event interaction based on the firing position, orientation, and fire result data. This event notifies other components about the impact of the projectile.
|
protectedvirtual |
Reduces ammunition count after firing.
| amount | Number of ammunition units to deplete (default: 1) |
Reduces the ammunition count in the current magazine by the specified amount, reflecting the consumption of ammunition when firing the weapon.
|
protectedvirtual |
Re-initializes pointers after a restore operation.
Re-assigns pointers to extended state data since the pointers could have become invalid during a save/restore operation.
|
protectedvirtual |
Checks if the weapon is allowed to fire.
Determines whether the weapon is currently allowed to fire based on ammunition availability, weapon state, and other conditions.
|
protectedvirtual |
Initiates the weapon firing sequence.
Creates and sends a fire interaction event, representing the firing of the weapon. This method is used only by VR Engage controlled entities.
|
protectedvirtual |
Calculates weapon recoil effects.
| worldShooterPosition | The position of the shooter in world coordinates |
| worldShooterOrientation | The orientation of the shooter in world coordinates |
Creates a hit offset to simulate weapon recoil. The offset increases with the number of rounds fired in rapid succession, simulating the cumulative effect of recoil on accuracy.
|
protected |
Assignment operator (not implemented)
Assignment operator is private and not implemented to prevent assignment.
References DtHumanGunJoyActuator().
|
protected |
Pointer to the human gun actuator descriptor.
Contains configuration parameters for this human gun actuator component.
|
protected |
Input port for controlling weapon azimuth aim.
Receives the azimuth at which to aim the weapon, in radians. Range: -pi to pi, with default value of 0.
|
protected |
Pointer to the firepower health state value.
Tracks the health/damage state of the weapon's firing capability.
|
protected |
Number of rounds remaining in current burst.
Tracks how many more rounds can be fired in the current burst firing sequence.
|
protected |
Type of munition selected for firing.
Stores the munition type received from FireInputMessage to use for subsequent firing operations.
|
protected |
World position for weapon firing.
Stores the location of the first burst fire received from FireInputMessage, used for subsequent rounds in a burst sequence.
|
protected |
World orientation for weapon firing.
Stores the orientation of the first burst fire received from FireInputMessage, used for subsequent rounds in a burst sequence.
|
protected |
Facade for human local object access.
Provides simplified access to human-specific functionality of the local object.
|
protected |
Flag indicating if this entity is currently player-controlled.
Tracks whether the entity is currently under player control, which affects how ammunition state is reported and other behaviors.
|
protected |
Pointer to the munition loader component.
Convenience pointer to the munition loader component, which must be of type DtVreMunitionLoader. Used to manage ammunition loading and state.