VR-Engage  2.3
Loading...
Searching...
No Matches
makVre::DtGunnerRangeSimLogic Class Reference

Detailed Description

DtGunnerRangeSimLogic periodically computes the range from the entity to the first object or terrain polygon it intersects. It casts a ray from the observer through the center point of the screen and sets the player attribute "range" with the distance in meters. The computation occurs at a configurable time interval.

#include <gunnerRangeSimLogic.h>

Inheritance diagram for makVre::DtGunnerRangeSimLogic:
[legend]

Public Member Functions

 DtGunnerRangeSimLogic ()
 
virtual ~DtGunnerRangeSimLogic () override
 
virtual bool initialize (DtPlayerStation *player, DtInitTable &config) override
 
virtual void tick (double dt) override
 
virtual void shutdown () override
 
virtual const char * type () const override
 
- Public Member Functions inherited from makVre::DtPlayerComponent
 DtPlayerComponent ()
 
virtual ~DtPlayerComponent ()
 
virtual bool postInitialize ()
 
bool componentReady () const
 
void setComponentReady (bool ready)
 
virtual DtInitTickStatus finalizeInitTick (double dt)
 
virtual void setName (const std::string &name)
 
virtual const std::string & name ()
 
virtual DtPlayerStation & player ()
 
virtual DtAttributeHandle & playerAttributeStore ()
 
virtual const DtAttributeHandle & playerAttributeStore () const
 
virtual const DtAttributeHandle & ownshipState () const
 
virtual void setExtendedData (const std::string &key, const std::string &value, DtEntityIdentifier entity=DtEntityIdentifier::nullId())
 

Protected Member Functions

virtual void updateRange ()
 
- Protected Member Functions inherited from makVre::DtPlayerComponent
virtual void initializeStateAttributes ()
 

Protected Attributes

double myTimeToUpdate
 
double myUpdateInterval
 
std::string myWindowName
 
std::string myChannelName
 
DtAttributeHandleType< double > myRangeAttr
 
DtAttributeHandleType< DtVector > myPositionAttr
 
DtAttributeHandleType< DtEntityIdentifier > myAttachedToAttr
 
- Protected Attributes inherited from makVre::DtPlayerComponent
bool myComponentReady = true
 
std::string myName
 
DtInitTable myConfig
 
DtPlayerStation * myPlayer
 
makVrv::DtDe * myDe
 
DtEntityResolver * myResolver
 
DtAttributeCallbackManager myAttributeCallbacks
 
DtVreMessageHandlerGroup myMessageHandlers
 

Constructor & Destructor Documentation

◆ DtGunnerRangeSimLogic()

makVre::DtGunnerRangeSimLogic::DtGunnerRangeSimLogic ( )

Constructor for DtGunnerRangeSimLogic.

Initializes component with default values for update interval (1 second), window name ("Window 1"), and channel name ("Channel 1")

◆ ~DtGunnerRangeSimLogic()

virtual makVre::DtGunnerRangeSimLogic::~DtGunnerRangeSimLogic ( )
overridevirtual

Destructor for DtGunnerRangeSimLogic.

Member Function Documentation

◆ initialize()

virtual bool makVre::DtGunnerRangeSimLogic::initialize ( DtPlayerStation * player,
DtInitTable & config )
overridevirtual

Initializes the gunner range simulation component.

Parameters
playerPointer to the player station this component belongs to
configConfiguration table containing range simulation settings
Returns
True if initialization succeeded, false otherwise

Configures the component with the following parameters from the configuration table:

  • updateInterval: Time in seconds between range updates (default: 1 second)
  • windowName: Name of the window to use for ray casting (default: "Window 1")
  • channelName: Name of the channel to use for ray casting (default: "Channel 1")

Also initializes the "range" player attribute to 0.0

Reimplemented from makVre::DtPlayerComponent.

References makVre::DtPlayerComponent::player().

◆ tick()

virtual void makVre::DtGunnerRangeSimLogic::tick ( double dt)
overridevirtual

Called every frame to update the range simulation.

Parameters
dtDelta time since the last frame in seconds

Calls updateRange() each tick to calculate the current range to target

Implements makVre::DtPlayerComponent.

◆ shutdown()

virtual void makVre::DtGunnerRangeSimLogic::shutdown ( )
overridevirtual

Shuts down the gunner range simulation component.

Performs any necessary cleanup operations

Reimplemented from makVre::DtPlayerComponent.

◆ type()

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

Returns the type identifier for this component.

Returns
The type string for DtGunnerRangeSimLogic

Implements makVre::DtPlayerComponent.

◆ updateRange()

virtual void makVre::DtGunnerRangeSimLogic::updateRange ( )
protectedvirtual

Computes the range to target at specified time intervals.

Called each tick to determine if it's time to update the range value. When triggered, casts a ray from the observer through the center of the screen and computes the distance to the first intersection. Sets the player attribute "range" with the calculated distance in meters.

Member Data Documentation

◆ myTimeToUpdate

double makVre::DtGunnerRangeSimLogic::myTimeToUpdate
protected

Simulation time at which the next range update should be computed.

◆ myUpdateInterval

double makVre::DtGunnerRangeSimLogic::myUpdateInterval
protected

Time interval in seconds between range updates.

Defaults to 1.0 second if not specified in configuration

◆ myWindowName

std::string makVre::DtGunnerRangeSimLogic::myWindowName
protected

Name of the window to use for ray casting.

Defaults to "Window 1" if not specified in configuration

◆ myChannelName

std::string makVre::DtGunnerRangeSimLogic::myChannelName
protected

Name of the channel to use for ray casting.

Defaults to "Channel 1" if not specified in configuration

◆ myRangeAttr

DtAttributeHandleType<double> makVre::DtGunnerRangeSimLogic::myRangeAttr
protected

Attribute handle storing the calculated range to the current aim point.

Attribute Store Keyrange

◆ myPositionAttr

DtAttributeHandleType<DtVector> makVre::DtGunnerRangeSimLogic::myPositionAttr
protected

Attribute handle storing the ownship's current geocentric position.

Attribute Store Keyownship.position

◆ myAttachedToAttr

DtAttributeHandleType<DtEntityIdentifier> makVre::DtGunnerRangeSimLogic::myAttachedToAttr
protected

Attribute handle storing the entity identifier of the vehicle the gunner is attached to.

Attribute Store KeyattachedTo

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