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

Detailed Description

The DtArtPartUpdater monitors specified articulated parts of the engaged entity. For each configured part, it provides two state attributes:

  • has[PartName]: Boolean indicating if the entity has the specified articulated part
  • [partName]State: Boolean indicating if the part's parameter value meets a configured threshold

This component is particularly useful for quickly determining states such as whether doors are open/closed or other articulated parts are in specific positions.

Example Lua configuration:

["artPartUpdater"] = {
componentType = "DtArtPartUpdater";
priority = 5;
artParts = {
{part = 3232, label = "slingLoadDoor", param = "theta", trueThreshold = 0};
{part = 7648, label = "cargoDoor", param = "theta", trueThreshold = 0};
{part = 7680, label = "slidingDoor", param = "y", trueThreshold = 0};
};
};

#include <artPartUpdater.h>

Inheritance diagram for makVre::DtArtPartUpdater:
[legend]

Public Member Functions

 DtArtPartUpdater ()
 
virtual ~DtArtPartUpdater () override
 
virtual bool initialize (makVre::DtPlayerStation *player, makVre::DtInitTable &config) override
 
virtual void tick (double dt) 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 Types

using partVars
 

Protected Member Functions

virtual void setHasPartAttribute (std::string partLabel, bool value)
 
virtual makVre::DtVreMessageResult handleSimState (makVre::DtVreMessage *msg)
 
virtual DtVreMessageResult handleMenuMessage (makVre::DtVreMessage *msg)
 
virtual void shutdown () override
 
virtual const char * type () const override
 
- Protected Member Functions inherited from makVre::DtPlayerComponent
virtual void initializeStateAttributes ()
 

Protected Attributes

std::map< int, partVarsmyParts
 
- Protected Attributes inherited from makVre::DtPlayerComponent
std::string myName
 
DtInitTable myConfig
 
DtPlayerStationmyPlayer
 
makVrv::DtDe * myDe
 
DtEntityResolvermyResolver
 
DtAttributeCallbackManager myAttributeCallbacks
 

Member Typedef Documentation

◆ partVars

Initial value:
struct
{
std::string label;
std::string param;
int trueThreshold;
}

Structure defining parameters for monitoring an articulated part.

Constructor & Destructor Documentation

◆ DtArtPartUpdater()

makVre::DtArtPartUpdater::DtArtPartUpdater ( )

Constructor for DtArtPartUpdater.

Initializes the component with the name "DtArtPartUpdater".

◆ ~DtArtPartUpdater()

virtual makVre::DtArtPartUpdater::~DtArtPartUpdater ( )
overridevirtual

Virtual destructor for DtArtPartUpdater.

Member Function Documentation

◆ initialize()

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

Initializes the component with configuration from Lua.

Processes the provided configuration to set up monitoring for specified articulated parts. Creates state attributes for each part and registers handlers for simulation state and menu action messages.

Parameters
playerPointer to the player station this component belongs to
configConfiguration table containing initialization parameters, especially the artParts table
Returns
True if initialization succeeds, false otherwise

Reimplemented from makVre::DtPlayerComponent.

References makVre::DtPlayerComponent::player().

◆ tick()

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

Updates the component state (empty implementation)

This method is called each frame, but currently has no implementation for this component.

Parameters
dtDelta time in seconds since the last tick

Implements makVre::DtPlayerComponent.

◆ setHasPartAttribute()

virtual void makVre::DtArtPartUpdater::setHasPartAttribute ( std::string partLabel,
bool value )
protectedvirtual

Sets the has[PartName] attribute in the state repository.

Creates or updates a state attribute of the form "has[PartName]" with the provided boolean value. The first character of the part label is capitalized in the attribute name.

Parameters
partLabelThe label of the articulated part
valueThe boolean value to set for the attribute

◆ handleSimState()

virtual makVre::DtVreMessageResult makVre::DtArtPartUpdater::handleSimState ( makVre::DtVreMessage * msg)
protectedvirtual

Handles simulation state messages.

Processes simulation state messages to extract articulated part information and updates corresponding state attributes based on the configured mappings. For each configured part that exists, sets has[PartName]=true and updates [partName]State based on the comparison with the threshold value.

Parameters
msgThe simulation state message to process
Returns
HANDLED if the message was successfully processed

◆ handleMenuMessage()

virtual DtVreMessageResult makVre::DtArtPartUpdater::handleMenuMessage ( makVre::DtVreMessage * msg)
protectedvirtual

Handles menu action messages.

Processes menu action messages specifically for the "cargoDoor" action. Based on the current cargoDoorState, sends appropriate entity task messages to open or close the cargo ramp.

Parameters
msgThe menu action message to process
Returns
HANDLED if the message was handled, IGNORED otherwise

◆ shutdown()

virtual void makVre::DtArtPartUpdater::shutdown ( )
overrideprotectedvirtual

Shuts down the component.

Removes the simulation state and menu action message handlers.

Reimplemented from makVre::DtPlayerComponent.

◆ type()

virtual const char * makVre::DtArtPartUpdater::type ( ) const
overrideprotectedvirtual

Returns the component type identifier.

Returns
The component type string

Implements makVre::DtPlayerComponent.

Member Data Documentation

◆ myParts

std::map<int, partVars> makVre::DtArtPartUpdater::myParts
protected

Map of art part IDs to their monitoring parameters.

The map keys are DIS articulated part type enumeration values, and the values are partVars structures.


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