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

Detailed Description

DtVehicleOccupantUpdater manages the visibility of vehicle occupant models (visual-only representations of drivers in vehicles) when a player assumes a driver role. It caches the current occupant visibility state when a player first takes control and restores that state when the player relinquishes control. During player control, the component ensures the occupant is visible to external observers while hiding it locally for the player to prevent visual obstructions.

#include <vehicleOccupantUpdater.h>

Inheritance diagram for makVre::DtVehicleOccupantUpdater:
[legend]

Public Member Functions

 DtVehicleOccupantUpdater ()
 
virtual ~DtVehicleOccupantUpdater () 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 DtPlayerStationplayer ()
 
virtual DtAttributeHandleplayerAttributeStore ()
 
virtual const DtAttributeHandleplayerAttributeStore () const
 

Protected Member Functions

virtual void showDriverOccupantExternally ()
 
virtual void hideDriverOccupantExternally ()
 
virtual void hideDriverOccupantLocally ()
 
virtual void showDriverOccupantLocally ()
 
virtual void cacheOccupantState ()
 
virtual void restoreOccupantState ()
 
- Protected Member Functions inherited from makVre::DtPlayerComponent
virtual void initializeStateAttributes ()
 

Protected Attributes

bool myPlayerIsImplicitDriver
 
bool myCachedOccupantState
 
bool myInitialHideOccupantsState
 
makVrv::DtObserver * myObserver
 
- Protected Attributes inherited from makVre::DtPlayerComponent
std::string myName
 
DtInitTable myConfig
 
DtPlayerStationmyPlayer
 
makVrv::DtDe * myDe
 
DtEntityResolvermyResolver
 
DtAttributeCallbackManager myAttributeCallbacks
 

Constructor & Destructor Documentation

◆ DtVehicleOccupantUpdater()

makVre::DtVehicleOccupantUpdater::DtVehicleOccupantUpdater ( )

Constructor for DtVehicleOccupantUpdater.

Initializes the component with default state values

◆ ~DtVehicleOccupantUpdater()

virtual makVre::DtVehicleOccupantUpdater::~DtVehicleOccupantUpdater ( )
overridevirtual

Virtual destructor for DtVehicleOccupantUpdater.

Member Function Documentation

◆ initialize()

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

Initializes the vehicle occupant updater component.

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

Determines whether the player is an implicit driver (directly controlling a vehicle) versus an embarked driver (a human player that entered a vehicle)

Reimplemented from makVre::DtPlayerComponent.

References makVre::DtPlayerComponent::player().

◆ tick()

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

Called every frame to update the occupant visibility state.

Parameters
dtDelta time since the last frame in seconds

If the player is an implicit driver, this function waits until it can detect the "HideOccupants" state. Once detected, it performs the following actions once:

  • Caches the initial occupant visibility state
  • Shows the driver occupant externally (to other observers)
  • Hides the driver occupant model locally (for the player's view)

Implements makVre::DtPlayerComponent.

◆ shutdown()

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

Shuts down the vehicle occupant updater component.

Restores the driver occupant model locally and resets the published "HideOccupants" state of the vehicle to its original value

Reimplemented from makVre::DtPlayerComponent.

◆ type()

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

Returns the type identifier for this component.

Returns
The type string for DtVehicleOccupantUpdater

Implements makVre::DtPlayerComponent.

◆ showDriverOccupantExternally()

virtual void makVre::DtVehicleOccupantUpdater::showDriverOccupantExternally ( )
protectedvirtual

Makes the driver occupant visible to external observers.

Sends an internal message indicating that the driver occupant for the vehicle should be visible. This ensures that other simulators and observers will see the driver model in the vehicle.

◆ hideDriverOccupantExternally()

virtual void makVre::DtVehicleOccupantUpdater::hideDriverOccupantExternally ( )
protectedvirtual

Makes the driver occupant visible to external observers.

Sends an internal message indicating that the driver occupant for the vehicle should be hidden. This ensures that other simulators and observers will hide the driver model in the vehicle.

◆ hideDriverOccupantLocally()

virtual void makVre::DtVehicleOccupantUpdater::hideDriverOccupantLocally ( )
protectedvirtual

Hides the driver occupant model in the local view.

Sends a message to hide the occupant model locally, preventing it from obstructing the player's view while driving

◆ showDriverOccupantLocally()

virtual void makVre::DtVehicleOccupantUpdater::showDriverOccupantLocally ( )
protectedvirtual

Shows the driver occupant model in the local view.

Sends a message to make the occupant model visible locally, typically called during shutdown to restore the original state

◆ cacheOccupantState()

virtual void makVre::DtVehicleOccupantUpdater::cacheOccupantState ( )
protectedvirtual

Saves the original occupant visibility state.

Reads and caches the initial "HideOccupants" attribute value to allow proper restoration during shutdown

◆ restoreOccupantState()

virtual void makVre::DtVehicleOccupantUpdater::restoreOccupantState ( )
protectedvirtual

Restores the original occupant visibility state.

Sends an internal message to reset the vehicle's occupant visibility to match the cached value from before player engagement

Member Data Documentation

◆ myPlayerIsImplicitDriver

bool makVre::DtVehicleOccupantUpdater::myPlayerIsImplicitDriver
protected

Flag indicating if player is directly controlling the vehicle (not embarked)

◆ myCachedOccupantState

bool makVre::DtVehicleOccupantUpdater::myCachedOccupantState
protected

Flag indicating if the initial occupant state has been cached.

◆ myInitialHideOccupantsState

bool makVre::DtVehicleOccupantUpdater::myInitialHideOccupantsState
protected

The initial value of the HideOccupants attribute.

◆ myObserver

makVrv::DtObserver* makVre::DtVehicleOccupantUpdater::myObserver
protected

Pointer to the observer being used by this component.


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