VR-Engage  2.2
Loading...
Searching...
No Matches
makVre::DtBallisticGunJoy Class Reference

Detailed Description

Uses Descriptor Type: DtBallisticGunDescriptor

#include <ballisticGunJoy.h>

Inheritance diagram for makVre::DtBallisticGunJoy:
[legend]

Public Member Functions

 DtBallisticGunJoy (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc, DtReaderWriterRegistry *const parentRegistry=0)
 
virtual ~DtBallisticGunJoy () override
 
virtual const char * type () const override
 
virtual bool createPorts () override
 
virtual void setComponentDescriptor (DtComponentDescriptor *descriptor) override
 
virtual void tick () 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 void detonationCallback (DtTimer *timer)
 
static DtSimComponent * creator (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 

Protected Attributes

bool myReportedNoArticulation
 
Ports and Port Groups
DtConstrainedAnalogInputPort * myElevationPort
 
DtBooleanInputPort * myActiveJoystickPort
 

Private Member Functions

 DtBallisticGunJoy ()
 
 DtBallisticGunJoy (const DtBallisticGunJoy &orig)
 
const DtBallisticGunJoyoperator= (const DtBallisticGunJoy &orig)
 

Constructor & Destructor Documentation

◆ DtBallisticGunJoy() [1/3]

makVre::DtBallisticGunJoy::DtBallisticGunJoy ( const DtString & name,
DtLocalObject * owner,
DtSimulationServices * simManager,
DtComponentDescriptor * desc,
DtReaderWriterRegistry *const parentRegistry = 0 )

Referenced by DtBallisticGunJoy(), and operator=().

◆ ~DtBallisticGunJoy()

virtual makVre::DtBallisticGunJoy::~DtBallisticGunJoy ( )
overridevirtual

Virtual destructor.

Cleans up resources used by the ballistic gun joy component.

◆ DtBallisticGunJoy() [2/3]

makVre::DtBallisticGunJoy::DtBallisticGunJoy ( )
private

Default constructor (not implemented)

Default constructor is private and not implemented to prevent creation of instances without proper initialization.

◆ DtBallisticGunJoy() [3/3]

makVre::DtBallisticGunJoy::DtBallisticGunJoy ( const DtBallisticGunJoy & orig)
private

Copy constructor (not implemented)

Copy constructor is private and not implemented to prevent copy construction.

References DtBallisticGunJoy().

Member Function Documentation

◆ type()

virtual const char * makVre::DtBallisticGunJoy::type ( ) const
overridevirtual

Gets the type identifier for this component.

Returns
String identifying the component type (DtBallisticGunJoyActuatorType)

Implements the DtSimComponent::type() method to return the type identifier for this component.

Reimplemented in makVre::DtHumanGunJoyActuator, and makVre::DtVreGunJoyActuator.

◆ createPorts()

virtual bool makVre::DtBallisticGunJoy::createPorts ( )
overridevirtual

Creates the input ports for the component.

Returns
True if ports were created successfully, false otherwise

Creates the elevation and joystick active input ports.

Reimplemented in makVre::DtHumanGunJoyActuator, and makVre::DtVreGunJoyActuator.

◆ setComponentDescriptor()

virtual void makVre::DtBallisticGunJoy::setComponentDescriptor ( DtComponentDescriptor * descriptor)
overridevirtual

Sets the component descriptor and extracts configuration values.

Parameters
descriptorThe component descriptor containing configuration parameters

Overrides the base class method to extract joystick-specific values and then calls the base class's method to set common parameters.

◆ tick()

virtual void makVre::DtBallisticGunJoy::tick ( )
overridevirtual

Updates the gun state each frame and handles firing.

Performs firing and detonation operations. Detects whether to use local or parent function based on joystick enable/disable state.

Reimplemented in makVre::DtHumanGunJoyActuator, and makVre::DtVreGunJoyActuator.

◆ setTarget()

virtual DtReal makVre::DtBallisticGunJoy::setTarget ( makVrf::DtArticulatedPartStateRepository * rotBody)
virtual

Sets the target for the gun.

Parameters
rotBodyThe articulated part state repository of the gun, or entity state if none exists
Returns
Distance to the target, or -1.0 if no target found

Uses targetSelection() to try to find an entity in the gun's line of fire; if it finds one, it sets the PSR->currentTarget.

◆ manualFireInteraction()

virtual makVrfEvents::DtFireEvent * makVre::DtBallisticGunJoy::manualFireInteraction ( makVrf::DtArticulatedPartStateRepository * rotBody)
virtual

Creates a fire interaction event.

Parameters
rotBodyThe articulated part state repository of the gun, or entity state if none exists
Returns
Pointer to the created fire event

Creates a fire interaction event. Uses the currentTarget in the PSR as the fire target, if present.

◆ manualDetonationInteraction()

virtual makVrfEvents::DtDetonationEvent * makVre::DtBallisticGunJoy::manualDetonationInteraction ( makVrf::DtArticulatedPartStateRepository * rotBody,
DtReal & detTime,
DtReal dist )
virtual

Creates a detonation interaction event.

Parameters
rotBodyThe articulated part state repository of the gun, or entity state if none exists
detTimeReference to store the detonation time
distDistance to the target
Returns
Pointer to the created detonation event

Creates a detonation interaction event based on the current target and distance.

◆ targetSelection()

virtual DtUUID makVre::DtBallisticGunJoy::targetSelection ( makVrf::DtArticulatedPartStateRepository * rotBody,
DtReal & dist )
virtual

Finds a target along the gun's firing direction.

Parameters
rotBodyThe articulated part state repository of the gun, or entity state if none exists
distReference to store the distance to the target
Returns
UUID of the first target found, or empty UUID if none found

Casts a ray out from the gun to a point MAX_RANGE away (currently 4000m). Determines, using physicalWorld->getVrfObjectsAlongChord(), if there are any platforms, lifeforms, or cultural features on the ray. Returns the UUID of the first one found and stores the range in the dist parameter.

◆ distanceToTarget()

virtual DtReal makVre::DtBallisticGunJoy::distanceToTarget ( )
virtual

Calculates the distance to the current target.

Returns
Distance to the target, or -1.0 if no target is set

Determines the distance from the gun to the currently selected target.

◆ detonationCallback()

static void makVre::DtBallisticGunJoy::detonationCallback ( DtTimer * timer)
static

Timer callback for detonation events.

Parameters
timerPointer to the timer that has expired

Casts the user data portion of the DtTimer to a DtDetonationTimerData object. Uses the Simulation Manager pointer in the DtDetonationTimerData to get the DtExerciseConn, and sends the makVrfEvents::DtDetonationEvent via the exercise connection. The timer is removed from the scheduler, and the DtDetonationTimerData and makVrfEvents::DtDetonationEvent objects are deleted.

◆ creator()

static DtSimComponent * makVre::DtBallisticGunJoy::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
nameThe name for the new component
ownerThe local object that will own this component
simManagerThe simulation services manager
descOptional component descriptor
parentRegistryOptional 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.

◆ operator=()

const DtBallisticGunJoy & makVre::DtBallisticGunJoy::operator= ( const DtBallisticGunJoy & orig)
private

Assignment operator (not implemented)

Returns
Reference to this object

Assignment operator is private and not implemented to prevent assignment.

References DtBallisticGunJoy().

Member Data Documentation

◆ myElevationPort

DtConstrainedAnalogInputPort* makVre::DtBallisticGunJoy::myElevationPort
protected

Input Port Name: elevation
Input Port Description:
Input Port Range: -1. to 1.
Input Port Default Value:
Input Group Parent: gun-control.

◆ myActiveJoystickPort

DtBooleanInputPort* makVre::DtBallisticGunJoy::myActiveJoystickPort
protected

Input Port Name: joystick-active
Input Port Description:
Input Port Range:
Input Port Default Value:
Input Group Parent: gun-control.

◆ myReportedNoArticulation

bool makVre::DtBallisticGunJoy::myReportedNoArticulation
protected

Flag to track missing articulation warning.

A flag to remember whether a warning message was printed about not finding an articulated part.


The documentation for this class was generated from the following file: