|
VR-Engage
2.2
|
DtActionMenuLogic is responsible for handling all user interaction menus in VR-Engage. It manages both static menus (like the main action menu) and context-sensitive quick menus that appear when the player approaches interactive objects like vehicles for embarkation, control stations, or other entities with interaction points.
The class processes entity proximity, evaluates interaction conditions, and provides the appropriate menu options based on the current context. It also handles menu selections and dispatches the appropriate actions in response.
#include <actionMenuLogic.h>
Public Member Functions | |
| DtActionMenuLogic () | |
| virtual | ~DtActionMenuLogic () override |
| virtual DtMenuManager * | getMenuManager () const |
| virtual bool | initialize (DtPlayerStation *player, DtInitTable &config) override |
| virtual bool | postInitialize () override |
| virtual void | tick (double dt) override |
| virtual void | shutdown () override |
| virtual const char * | type () const override |
| virtual void | handleEmbarkedChanged (bool embarked) |
| virtual void | handleAimingChanged (bool aiming) |
| virtual void | handleHealthChanged (double health) |
| virtual void | handleDeployableObjectsChanged (DtDeployableObjectsSimLogic::DeployableObjectStateMap deployableObjects) |
| virtual void | showMenu (const std::string &name="Action", MenuSetStateMessage::Type type=MenuSetStateMessage::Type_STATIC, const std::string &selection="") |
| virtual void | hideMenu (const std::string &name) |
| virtual void | hideQuickMenu () |
| virtual void | toggleActionMenu (float val=1) |
| virtual DtEntityIdentifier | currentQuickMenuEntityId () |
Public Member Functions inherited from makVre::DtPlayerComponent | |
| DtPlayerComponent () | |
| virtual | ~DtPlayerComponent () |
| virtual void | setName (const std::string &name) |
| virtual const std::string & | name () |
| virtual DtPlayerStation & | player () |
| virtual DtAttributeHandle & | playerAttributeStore () |
| virtual const DtAttributeHandle & | playerAttributeStore () const |
Protected Types | |
| using | WaypointMap = std::map<std::string, std::string> |
| using | RouteMap = std::map<std::string, std::string> |
| using | BullseyeMap = std::map<std::string, std::string> |
Protected Member Functions | |
| virtual void | updateActionObject (const DtEntityIdentifier &entityId, const DtEntityType &entityType, const std::string &marking) |
| virtual bool | checkMenuDisplayConditionsMet () |
| virtual void | updateQuickMenuVisibility () |
| virtual bool | checkActionPointListActionable (const EntityEmbarkationInformationMessage &msg) |
| virtual bool | processSlotActionPoints (const EntityEmbarkationInformationMessage &msg) |
| virtual bool | findTransformsForSlotPointProcessing (const makVrv::DtSceneObject *obj, DtVector &ownPos, DtVector &objPos, DtDcm &worldToOwnRot, DtDcm &objToWorldRot) const |
| virtual bool | findActionablePoints (const DtVector &ownPos, const DtVector &objPos, const DtDcm &worldToOwnRot, const DtDcm &objToWorldRot, const std::vector< EntityEmbarkationInformationMessage::ActionPoint > &actionPoints) |
| virtual bool | scoreActionPoint (DtVector vecToPoint, double maxDist, double &retScore) |
| virtual void | modifyActionPointVectorBeforeScore (DtVector &vecToPoint) |
| virtual double | combineDotAndDistScore (double dotScore, double distScore) |
| virtual DtVreMessageResult | handleSensorUpdate (DtVreMessage *message) |
| virtual DtVreMessageResult | handleEntityStateBool (DtVreMessage *msg) |
| virtual DtVreMessageResult | handleEntityEmbarkationInformationMessage (DtVreMessage *msg) |
| virtual DtVreMessageResult | handleMenuMessage (DtVreMessage *msg) |
| virtual DtVreMessageResult | handleMenuAction (DtVreMessage *msg) |
| virtual DtVreMessageResult | handleEntityDiscovered (DtVreMessage *msg) |
| virtual DtVreMessageResult | handleEntityRemoved (DtVreMessage *msg) |
| virtual DtVreMessageResult | handleRequestEntitiesByTypeResponse (DtVreMessage *msg) |
| virtual DtVreMessageResult | handleSessionPlayState (DtVreMessage *msg) |
| virtual bool | entityIdIsDeployableObject (const DtEntityIdentifier &entityId) |
| virtual bool | groundVehicleIsEnabled () const |
| virtual bool | vehicleHasImplicitDriver (const DtEntityIdentifier &vehicleId) const |
Protected Member Functions inherited from makVre::DtPlayerComponent | |
| virtual void | initializeStateAttributes () |
Protected Attributes | |
| DtInputLogic | myInputLogic |
| DtInitTable | myQuickMenuTable |
| std::string | myCurrentQuickMenu |
| DtEntityIdentifier | myCurrentQuickMenuEntityId |
| DtEntityType | myCurrentQuickMenuEntityType |
| bool | myCurrentEntityIsHost |
| bool | myCurrentEntitySupportsVreSlots |
| EntityEmbarkationInformationMessage | myLastSlotDataMessage |
| double | myQuickMenuSlotTickTimer |
| double | mySlotProximityMaxDistance |
| double | mySlotProximityZScale |
| double | mySlotProximityAngleWeight |
| double | mySlotProximityFov |
| double | mySlotProximityRearMaxDist |
| double | mySlotProximityOverlapDist |
| std::map< std::string, int > | myActionablePointsMap |
| std::string | myLastNote |
| DtVector | myTaskLocation |
| bool | myDebugMenuToggle |
Protected Attributes inherited from makVre::DtPlayerComponent | |
| std::string | myName |
| DtInitTable | myConfig |
| DtPlayerStation * | myPlayer |
| makVrv::DtDe * | myDe |
| DtEntityResolver * | myResolver |
| DtAttributeCallbackManager | myAttributeCallbacks |
|
protected |
Type definition for waypoint maps.
Maps waypoint identifiers to waypoint information.
|
protected |
Type definition for route maps.
Maps route identifiers to route information.
|
protected |
Type definition for bullseye maps.
Maps bullseye identifiers to bullseye information. Used to show VRF Bullseye list in VRE pilot Set Bullseye menu.
| makVre::DtActionMenuLogic::DtActionMenuLogic | ( | ) |
Constructor.
Creates a new action menu logic component with default state.
|
overridevirtual |
Virtual destructor.
Ensures proper cleanup of derived action menu logic classes.
|
virtual |
Gets the menu manager instance.
Provides access to the menu manager that controls all menus for this player station instance. The menu manager handles the creation, organization, and display of menus.
|
overridevirtual |
Initializes the action menu logic.
| player | Pointer to the owning player station |
| config | Configuration data for initialization |
Sets up the action menu system based on the provided configuration. This includes loading menu definitions, setting up input handlers, and initializing the menu manager.
Reimplemented from makVre::DtPlayerComponent.
References makVre::DtPlayerComponent::player().
|
overridevirtual |
Performs post-initialization setup.
Completes setup tasks that need to occur after basic initialization, such as connecting to message handlers and setting up callbacks.
Reimplemented from makVre::DtPlayerComponent.
|
overridevirtual |
Updates the menu system.
| dt | Time interval since the last tick in seconds |
Called once per frame to update the menu system. This includes checking for proximity to interaction points, updating menu visibility, and processing any pending menu actions.
Implements makVre::DtPlayerComponent.
|
overridevirtual |
Shuts down the action menu system.
Performs cleanup when the action menu system is no longer needed. This includes disconnecting from message handlers, removing input handlers, and destroying menu resources.
Reimplemented from makVre::DtPlayerComponent.
|
overridevirtual |
Returns the component type identifier.
Returns the type identifier string for this component, which is used by the VR-Engage framework for component identification and management. The returned value matches DtActionMenuLogicType.
Implements makVre::DtPlayerComponent.
Referenced by showMenu().
|
virtual |
Handles changes in player embarkation state.
| embarked | True if the player is now embarked, false if disembarked |
Called when the player's embarkation state changes. This affects the available menu options, as different actions are available depending on whether the player is on foot or in a vehicle.
|
virtual |
Handles changes in player aiming state.
| aiming | True if the player is now aiming, false otherwise |
Called when the player's aiming state changes. This may affect menu visibility and available options, as some menus may be disabled while aiming.
|
virtual |
Handles changes in player health.
| health | New health value |
Called when the player's health changes. This may affect available menu options, such as enabling medical actions when health is low.
|
virtual |
Handles changes in deployed objects list.
| deployableObjects | Map of deployed object identifiers to entity data |
Called when the list of player-deployed objects (like sensors, markers, etc.) changes. This affects the available menu options for interacting with deployed objects.
|
virtual |
Shows a specific menu.
| name | Name of the menu to show (defaults to "Action" for main menu) |
| type | Type of menu display (static or dynamic/contextual) |
| selection | Initial selection to make in the menu |
Displays the specified menu to the user. The menu type determines how it behaves - static menus remain open until explicitly closed, while dynamic menus may close automatically after selection or when context changes.
References makVre::DtPlayerComponent::name(), type(), and makVre::MenuSetStateMessage::Type_STATIC.
|
virtual |
Hides a specific menu.
| name | Name of the menu to hide |
Hides the specified menu if it is currently visible.
References makVre::DtPlayerComponent::name().
|
virtual |
Hides the currently active quick menu.
Hides any context-sensitive quick menu that is currently visible. Quick menus appear when the player approaches interactive objects.
|
virtual |
Toggles the main action menu.
| val | Input value (typically 1.0 for full toggle) |
Toggles the visibility of the main action menu. If it's currently visible, it will be hidden; if hidden, it will be shown. The value parameter supports analog inputs like joysticks.
|
virtual |
Gets the entity ID associated with the current quick menu.
Returns the identifier of the entity that the current quick menu is associated with (e.g., a vehicle the player is interacting with). Returns an empty identifier if no quick menu is active.
|
protectedvirtual |
Updates the current action object.
| entityId | Identifier of the entity to set as the current action object |
| entityType | Type of the entity |
| marking | Entity marking or name |
Sets the specified entity as the current action object, which affects the available menu options and context-sensitive actions.
|
protectedvirtual |
Checks if menu display conditions are met.
Evaluates the current state to determine if menus should be displayed. This considers factors like player posture, health, and context.
|
protectedvirtual |
Updates quick menu visibility based on current state.
Determines whether context-sensitive quick menus should be shown or hidden based on proximity to interactive objects and other conditions.
|
protectedvirtual |
Checks if action points in an entity's embarkation message are actionable.
| msg | The embarkation information message to evaluate |
Examines embarkation information to determine if any action points (like entry points, control stations, etc.) are within interactive range.
|
protectedvirtual |
Processes action points for a slotted entity.
| msg | Embarkation information message containing action point data |
Analyzes and processes action points for slotted entities (like vehicles with multiple seats/positions), determining which are actionable and should appear in menus.
|
protectedvirtual |
Finds the coordinate transformations needed for action point processing.
| obj | Scene object representing the entity with action points |
| ownPos | Output parameter for player's position |
| objPos | Output parameter for object's position |
| worldToOwnRot | Output parameter for world-to-player rotation matrix |
| objToWorldRot | Output parameter for object-to-world rotation matrix |
Calculates the positions and rotation matrices needed to transform action points from object space to world space for distance and angle calculations.
|
protectedvirtual |
Identifies actionable points based on proximity and orientation.
| ownPos | Player's position |
| objPos | Object's position |
| worldToOwnRot | World-to-player rotation matrix |
| objToWorldRot | Object-to-world rotation matrix |
| actionPoints | List of action points to evaluate |
Analyzes each action point to determine if it's within actionable range and orientation relative to the player, scoring them for priority.
|
protectedvirtual |
Scores an action point for actionability.
| vecToPoint | Vector from player to action point |
| maxDist | Maximum distance for actionability |
| retScore | Output parameter for the computed score |
Computes a score for an action point based on distance and orientation relative to the player. Higher scores indicate more easily accessible points.
|
protectedvirtual |
Modifies a vector to an action point before scoring.
| vecToPoint | Vector to modify |
Applies adjustments to the vector from player to action point before scoring, such as scaling components or normalizing.
|
protectedvirtual |
Combines dot product and distance scores.
| dotScore | Score based on dot product (angle) |
| distScore | Score based on distance |
Combines the orientation and distance scores into a single value representing the overall accessibility of an action point.
|
protectedvirtual |
Handles sensor update messages.
| message | Pointer to the sensor update message |
Processes sensor update messages that may affect menu options for sensor-related actions.
|
protectedvirtual |
Handles entity state boolean messages.
| msg | Pointer to the entity state message |
Processes boolean state changes for entities that may affect menu visibility and available options.
|
protectedvirtual |
Handles embarkation information messages.
| msg | Pointer to the embarkation information message |
Processes embarkation information that describes interaction points for entities like vehicles, which affects quick menu availability.
|
protectedvirtual |
Handles menu state messages.
| msg | Pointer to the menu message |
Processes messages related to menu state changes, such as requests to show or hide specific menus.
|
protectedvirtual |
Handles menu action messages.
| msg | Pointer to the menu action message |
Processes action messages generated when a user selects an option from a menu, executing the corresponding action.
|
protectedvirtual |
Handles entity discovery messages.
| msg | Pointer to the entity discovered message |
Processes notifications about newly discovered entities that may be candidates for interaction menus.
|
protectedvirtual |
Handles entity removal messages.
| msg | Pointer to the entity removed message |
Processes notifications about entities being removed from the simulation, cleaning up any associated menu resources.
|
protectedvirtual |
Handles responses to entity type queries.
| msg | Pointer to the response message |
Processes responses to queries about entities of specific types, which may affect available menu options for type-specific actions.
|
protectedvirtual |
Handles session play state changes.
| msg | Pointer to the session play state message |
Processes notifications about simulation session state changes (e.g., paused, playing, stopped), which may affect menu availability.
|
protectedvirtual |
Checks if an entity ID corresponds to a deployed object.
| entityId | The entity identifier to check |
Determines whether the specified entity is one of the player's deployable objects (like sensors, markers, etc.).
|
protectedvirtual |
Checks if the player has a ground vehicle license.
Checks state attribute "GroundVehicleEnabled" to determine if player has a ground vehicle license.
|
protectedvirtual |
Checks if a vehicle has an implicit driver.
| vehicleId | Identifier of the vehicle to check |
Checks if given vehicle has an implicit driver (a visual-only model of a driver occupant).
|
protected |
Input logic handler for menu interactions.
Manages input mapping and handling for menu navigation and selection.
|
protected |
Configuration table for quick menus.
|
protected |
Name of the currently active quick menu.
|
protected |
Entity ID associated with the current quick menu.
|
protected |
Entity type of the current quick menu target.
|
protected |
Flag indicating if the current entity is a host entity.
|
protected |
Flag indicating if the current entity supports VRE slots.
|
protected |
Last received embarkation information message.
Stores the most recent embarkation information for slot processing, containing action points and slot details for interactive entities.
|
protected |
Timer for quick menu slot proximity checks.
Controls how frequently slot proximity is checked for quick menu updates.
|
protected |
Maximum distance for slot proximity detection.
The maximum distance at which slots/action points are considered actionable.
|
protected |
Scaling factor for vertical (Z) distance in proximity calculations.
Adjusts the importance of vertical distance in determining proximity to action points.
|
protected |
Weight given to angle in proximity calculations.
Determines how heavily the angle between player and action point affects actionability.
|
protected |
Field of view angle for forward-facing action points.
The angle (in radians) defining the forward field of view within which action points are more easily actionable.
|
protected |
Maximum distance for rear-facing action points.
The maximum distance at which action points behind the player are actionable.
|
protected |
Distance overlap tolerance for action points.
The distance by which action point ranges can overlap before prioritization occurs.
|
protected |
Map of actionable points and their priority scores.
Maps action point identifiers to their calculated priority scores.
|
protected |
Last notification or hint displayed to the user.
Stores the text of the last note shown to avoid duplicate notifications.
|
protected |
Location of the current task objective.
Stores the position of the current objective or task target.
|
protected |
Flag to toggle debug menu visibility.
Controls whether debug menus are shown for development and testing.