#include <vreGunActuator.h>
|
| | DtVreGunActuator (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) |
| |
| virtual | ~DtVreGunActuator () override |
| |
| virtual bool | init () override |
| |
| virtual const char * | type () const override |
| |
| virtual void | tick () override |
| |
| virtual void | preFirstTickInit () override |
| |
|
| static DtSimComponent * | creator (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) |
| |
◆ DtVreGunActuator() [1/3]
| makVre::DtVreGunActuator::DtVreGunActuator |
( |
| ) |
|
|
protected |
Default constructor (not implemented)
Default constructor is protected and not implemented to prevent creation of instances without proper initialization.
Referenced by DtVreGunActuator(), and operator=().
◆ DtVreGunActuator() [2/3]
Copy constructor (not implemented)
Copy constructor is protected and not implemented to prevent copy construction.
References DtVreGunActuator().
◆ DtVreGunActuator() [3/3]
| makVre::DtVreGunActuator::DtVreGunActuator |
( |
const DtString & | name, |
|
|
DtLocalObject * | owner, |
|
|
DtSimulationServices * | simManager, |
|
|
DtComponentDescriptor * | desc = 0, |
|
|
DtReaderWriterRegistry * | parentRegistry = 0 ) |
Constructor.
- Parameters
-
| 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 gun actuator component with the specified parameters.
◆ ~DtVreGunActuator()
| virtual makVre::DtVreGunActuator::~DtVreGunActuator |
( |
| ) |
|
|
overridevirtual |
Virtual destructor.
Cleans up resources used by the gun actuator component, including any pending detonation timers.
◆ operator=()
Assignment operator (not implemented)
- Returns
- Reference to this object
Assignment operator is protected and not implemented to prevent assignment.
References DtVreGunActuator().
◆ init()
| virtual bool makVre::DtVreGunActuator::init |
( |
| ) |
|
|
overridevirtual |
Initializes the gun actuator.
- Returns
- True if initialization is successful, false otherwise
Performs initial setup of the gun actuator, including port connections and state initialization. Called during component initialization.
◆ type()
| virtual const char * makVre::DtVreGunActuator::type |
( |
| ) |
const |
|
overridevirtual |
Gets the type identifier for this component.
- Returns
- String identifying the component type (DtVreGunActuatorType)
Implements the DtSimComponent::type() method to return the type identifier for this component.
◆ tick()
| virtual void makVre::DtVreGunActuator::tick |
( |
| ) |
|
|
overridevirtual |
Updates the actuator state each simulation frame.
Processes input controls, manages firing state, and handles ammunition consumption during each simulation frame. This is the main update method called every simulation tick.
◆ preFirstTickInit()
| virtual void makVre::DtVreGunActuator::preFirstTickInit |
( |
| ) |
|
|
overridevirtual |
Performs initialization before the first simulation tick.
Sets up initial states and configurations before the simulation begins. This initialization is performed once before the first tick of the simulation.
◆ creator()
| static DtSimComponent * makVre::DtVreGunActuator::creator |
( |
const DtString & | name, |
|
|
DtLocalObject * | owner, |
|
|
DtSimulationServices * | simManager, |
|
|
DtComponentDescriptor * | desc = 0, |
|
|
DtReaderWriterRegistry * | parentRegistry = 0 ) |
|
static |
Factory method to create a new instance of this component.
- Parameters
-
| 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 |
- Returns
- Pointer to the newly created component
Static factory method used by the component creation system to instantiate new instances of this component type.
◆ createPortGroups()
| virtual bool makVre::DtVreGunActuator::createPortGroups |
( |
| ) |
|
|
overrideprotectedvirtual |
Creates the port groups for weapon control.
- Returns
- True if port groups are successfully created, false otherwise
Overridden to create the weapon control input port group. This method creates the port group structure needed for handling weapon control inputs.
◆ createPorts()
| virtual bool makVre::DtVreGunActuator::createPorts |
( |
| ) |
|
|
overrideprotectedvirtual |
Creates the input and output ports for the actuator.
- Returns
- True if ports are successfully created, false otherwise
Overridden to create local ports for weapon control inputs and outputs, such as fire, next weapon, previous weapon, and firing state ports.
◆ createPSR()
| virtual bool makVre::DtVreGunActuator::createPSR |
( |
| ) |
|
|
protectedvirtual |
Creates the process state repository for the actuator.
- Returns
- True if the PSR is successfully created, false otherwise
Creates the myProcessState data member and adds it to the process state repository manager. Uses the name and type specified in the component descriptor (if they exist) or appropriate defaults if not specified. This PSR is used to maintain state across simulation frames and saves.
◆ getFireResult()
| virtual void makVre::DtVreGunActuator::getFireResult |
( |
const DtVector & | shooterPosition, |
|
|
const DtTaitBryan | shooterOrienation, |
|
|
DtFireResult & | fireResult ) |
|
protectedvirtual |
Calculates the result of firing the weapon.
- Parameters
-
| shooterPosition | The geocentric position of the shooter |
| shooterOrienation | The orientation of the shooter |
| fireResult | Output parameter that will contain the fire result |
Calculates the result of firing the weapon from the given position and orientation. This includes determining if a target was hit, the range to the target, and the detonation result. The results are stored in the provided fireResult structure.
◆ createFireInteraction()
| virtual makVrfEvents::DtFireEvent * makVre::DtVreGunActuator::createFireInteraction |
( |
const DtVector & | firingPosition, |
|
|
const DtTaitBryan | firingOrientation ) |
|
protectedvirtual |
Creates a fire event for interaction processing.
- Parameters
-
| firingPosition | The geocentric position of the firing point |
| firingOrientation | The orientation of the firing point |
- Returns
- Pointer to the created fire event, or nullptr if creation failed
Creates and initializes a fire event based on the specified position and orientation. This event represents the firing of the weapon and is used in the interaction system.
◆ createDetonationInteraction()
| virtual makVrfEvents::DtDetonationEvent * makVre::DtVreGunActuator::createDetonationInteraction |
( |
const DtVector & | firingPosition, |
|
|
const DtTaitBryan | firingOrientation, |
|
|
const DtFireResult & | fireResult, |
|
|
DtReal & | detTime ) |
|
protectedvirtual |
Creates a detonation event for interaction processing.
- Parameters
-
| firingPosition | The geocentric position of the firing point |
| firingOrientation | The orientation of the firing point |
| fireResult | The results of the firing calculation |
| detTime | Output parameter that will contain the detonation time |
- Returns
- Pointer to the created detonation event, or nullptr if creation failed
Creates and initializes a detonation event based on the specified position, orientation, and fire result. This event represents the detonation of a projectile and is used in the interaction system. The detonation time is calculated and returned in the detTime parameter.
◆ decrementResource()
| virtual void makVre::DtVreGunActuator::decrementResource |
( |
| ) |
|
|
protectedvirtual |
Decrements the ammunition resource count.
Decrements the available ammunition count for the current munition type. This is called after firing the weapon to reflect ammunition consumption.
◆ scheduleDetonation()
| virtual void makVre::DtVreGunActuator::scheduleDetonation |
( |
makVrfEvents::DtDetonationEvent * | detInter, |
|
|
DtTime | detTime ) |
|
protectedvirtual |
Schedules a detonation event to occur at a specific time.
- Parameters
-
| detInter | Pointer to the detonation event to schedule |
| detTime | The simulation time at which the detonation should occur |
Schedules a detonation event to occur at the specified simulation time. This creates a timer that will trigger the detonation callback when the time is reached.
◆ calculateMuzzlePosition()
| DtVector makVre::DtVreGunActuator::calculateMuzzlePosition |
( |
| ) |
|
|
protected |
Calculates the current muzzle position in world coordinates.
- Returns
- Vector containing the muzzle position coordinates
Calculates the current world position of the weapon muzzle based on the entity position, orientation, and configured muzzle offset.
◆ setCurrentMunition()
| void makVre::DtVreGunActuator::setCurrentMunition |
( |
int | munition | ) |
|
|
protected |
Sets the current munition type for the weapon.
- Parameters
-
| munition | Index of the munition type to set as current |
Updates the current munition type used by the weapon, which affects the ammunition type consumed and the firing characteristics.
◆ findResource()
| DtSimResource * makVre::DtVreGunActuator::findResource |
( |
DtEntityType | resourceType | ) |
|
|
protected |
Finds a specific resource by type.
- Parameters
-
| resourceType | The entity type of the resource to find |
- Returns
- Pointer to the resource if found, nullptr otherwise
Searches for and returns a pointer to a resource of the specified type. This is used to access ammunition resources for the weapon.
◆ detonationCallback()
| static void makVre::DtVreGunActuator::detonationCallback |
( |
DtTimer * | timer | ) |
|
|
staticprotected |
Callback function for detonation timers.
- Parameters
-
| timer | Pointer to the timer that triggered this callback |
Static callback function called when a detonation timer expires. This processes the detonation event associated with the timer.
◆ myWeaponPortGroup
| DtInputPortGroup* makVre::DtVreGunActuator::myWeaponPortGroup |
|
protected |
Port group for weapon control inputs.
◆ myFirePort
| DtBooleanInputPort* makVre::DtVreGunActuator::myFirePort |
|
protected |
Input port for fire command.
◆ myNextWeaponPort
| DtBooleanInputPort* makVre::DtVreGunActuator::myNextWeaponPort |
|
protected |
Input port for next weapon selection.
◆ myPreviousWeaponPort
| DtBooleanInputPort* makVre::DtVreGunActuator::myPreviousWeaponPort |
|
protected |
Input port for previous weapon selection.
◆ myFiringPort
| DtBooleanOutputPort* makVre::DtVreGunActuator::myFiringPort |
|
protected |
Output port for firing state.
◆ myIsFiring
| bool makVre::DtVreGunActuator::myIsFiring |
|
protected |
Flag indicating whether the weapon is currently firing.
◆ myCurrentMunition
| int makVre::DtVreGunActuator::myCurrentMunition |
|
protected |
Index of the currently selected munition type.
◆ myAttachedPart
| int makVre::DtVreGunActuator::myAttachedPart |
|
protected |
Part ID of the articulated part the weapon is attached to.
◆ myMuzzleSpeed
| double makVre::DtVreGunActuator::myMuzzleSpeed |
|
protected |
Muzzle velocity of fired projectiles in meters per second.
◆ myRoundsPerMagazine
| int makVre::DtVreGunActuator::myRoundsPerMagazine |
|
protected |
Number of rounds per magazine for ammunition management.
◆ myRoundsPerMinute
| int makVre::DtVreGunActuator::myRoundsPerMinute |
|
protected |
Rate of fire in rounds per minute.
◆ myMuzzleOffset
| DtVector makVre::DtVreGunActuator::myMuzzleOffset |
|
protected |
Offset vector from entity origin to muzzle position.
◆ myLoadTime
| double makVre::DtVreGunActuator::myLoadTime |
|
protected |
Time required to load the weapon in seconds.
◆ myUnloadTime
| double makVre::DtVreGunActuator::myUnloadTime |
|
protected |
Time required to unload the weapon in seconds.
◆ myRange
| double makVre::DtVreGunActuator::myRange |
|
protected |
Maximum effective range of the weapon in meters.
◆ myRangeName
| std::string makVre::DtVreGunActuator::myRangeName |
|
protected |
Name of the range parameter for configuration.
◆ myRoundsPerDetonation
| int makVre::DtVreGunActuator::myRoundsPerDetonation |
|
protected |
Number of rounds consumed per detonation event.
◆ myMunitionList
| std::vector<DtEntityType> makVre::DtVreGunActuator::myMunitionList |
|
protected |
List of available munition types for this weapon.
◆ myTimerList
| DtList makVre::DtVreGunActuator::myTimerList |
|
protected |
List of active detonation timers.
◆ myReportedNoArticulation
| bool makVre::DtVreGunActuator::myReportedNoArticulation |
|
protected |
Flag indicating whether a missing articulation warning has been reported.
◆ myProcessState
| DtVrfBalGunPSR* makVre::DtVreGunActuator::myProcessState |
|
protected |
Process state repository for preserving state data.
Container for state data associated with this component. This state is saved and restored as part of a scenario (or checkpoint).
◆ myGunDescriptor
Pointer to the gun actuator descriptor with configuration parameters.
◆ myCurrentTarget
| DtSimObjectReference makVre::DtVreGunActuator::myCurrentTarget |
|
protected |
Reference to the current target entity.
Set by createFireInteraction and used by createDetonationInteraction.
◆ myCurrentEventId
| DtString makVre::DtVreGunActuator::myCurrentEventId |
|
protected |
Current event ID for tracking interaction events.
Set by createFireInteraction and used by createDetonationInteraction.
◆ myCurrentRange
| DtReal makVre::DtVreGunActuator::myCurrentRange |
|
protected |
Current range to target in meters.
Set by createFireInteraction and used by createDetonationInteraction.
The documentation for this class was generated from the following file: