|
VR-Engage
2.2
|
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>
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 () |
| virtual void | setName (const std::string &name) |
| virtual const std::string & | name () |
| virtual DtPlayerStation & | player () |
| virtual DtAttributeHandle & | playerAttributeStore () |
| virtual const DtAttributeHandle & | playerAttributeStore () const |
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 |
Protected Attributes inherited from makVre::DtPlayerComponent | |
| std::string | myName |
| DtInitTable | myConfig |
| DtPlayerStation * | myPlayer |
| makVrv::DtDe * | myDe |
| DtEntityResolver * | myResolver |
| DtAttributeCallbackManager | myAttributeCallbacks |
| 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")
|
overridevirtual |
Destructor for DtGunnerRangeSimLogic.
|
overridevirtual |
Initializes the gunner range simulation component.
| player | Pointer to the player station this component belongs to |
| config | Configuration table containing range simulation settings |
Configures the component with the following parameters from the configuration table:
Also initializes the "range" player attribute to 0.0
Reimplemented from makVre::DtPlayerComponent.
References makVre::DtPlayerComponent::player().
|
overridevirtual |
Called every frame to update the range simulation.
| dt | Delta time since the last frame in seconds |
Calls updateRange() each tick to calculate the current range to target
Implements makVre::DtPlayerComponent.
|
overridevirtual |
Shuts down the gunner range simulation component.
Performs any necessary cleanup operations
Reimplemented from makVre::DtPlayerComponent.
|
overridevirtual |
Returns the type identifier for this component.
Implements makVre::DtPlayerComponent.
|
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.
|
protected |
Simulation time at which the next range update should be computed.
|
protected |
Time interval in seconds between range updates.
Defaults to 1.0 second if not specified in configuration
|
protected |
Name of the window to use for ray casting.
Defaults to "Window 1" if not specified in configuration
|
protected |
Name of the channel to use for ray casting.
Defaults to "Channel 1" if not specified in configuration