|
VR-Engage
2.2
|
The DtCommanderHatchControlLogic provides the capability to look around as a human observer from a point of view on a vehicle (i.e., an open hatch) with support for binoculars and night vision goggles (NVG). It handles head movement (yaw/pitch) and equipment toggling (binoculars, NVG).
Input handler details (for configuring in an SMS input configuration file):
This class supports the following input handler functions that may be configured to map to input devices in role input configuration files:
The input group name is provided in the role configuration file and is used to distinguish input handlers when multiple handlers are present on the entity. The default input group is "commander-hatch".
#include <commanderHatchControlLogic.h>
Public Member Functions | |
| DtCommanderHatchControlLogic () | |
| virtual | ~DtCommanderHatchControlLogic () override |
| virtual bool | initialize (makVre::DtPlayerStation *player, makVre::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 | yaw (double val) |
| virtual void | pitch (double val) |
| virtual void | toggleBinoculars (double val) |
| virtual void | setBinocularsControls (bool enabled) |
| virtual void | zoomOut (double value) |
| virtual void | zoomIn (double value) |
| virtual void | zoom (double value) |
| virtual void | toggleNVG (double val) |
Public Member Functions inherited from makVre::DtEntityControlLogic | |
| DtEntityControlLogic () | |
| virtual | ~DtEntityControlLogic () override |
| virtual void | setExtendedData (const std::string &key, const std::string &value, DtEntityIdentifier entity=DtEntityIdentifier::nullId()) |
| virtual void | setMouseControlEnabled (bool enabled) |
| virtual bool | isMouseControlEnabled () |
| virtual bool | isMouseControlSupportAllowed () const |
| virtual void | setMouseControlSupportAllowed (bool enable) |
| virtual const std::vector< std::string > & | joystickGroups () const |
| virtual makVre::DtVreMessageResult | handleSimState (makVre::DtVreMessage *msg) |
| virtual makVre::DtVreMessageResult | handleStateMessages (makVre::DtVreMessage *message) |
| virtual makVre::DtVreMessageResult | handleReset (makVre::DtVreMessage *message) |
| virtual void | reset (float val) |
| virtual void | resetInPlace (float val) |
| virtual void | toggleMouseControl (float val) |
| virtual void | enableMouseControl (float val) |
| virtual makVre::DtVreMessageResult | handleFocusMessage (makVre::DtVreMessage *message) |
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 Member Functions | |
| virtual DtVreMessageResult | handleMenuMessage (makVre::DtVreMessage *msg) |
| void | onBinocularsChanged (bool usingBinoculars) |
Protected Member Functions inherited from makVre::DtEntityControlLogic | |
| virtual void | takeControlOfPlayerEntity () |
| virtual void | releaseControlOfPlayerEntity () |
Protected Member Functions inherited from makVre::DtPlayerComponent | |
| virtual void | initializeStateAttributes () |
Protected Attributes | |
| DtInputLogic | myInputLogic |
| std::string | myMainControlGroup |
| float | myYawInput |
| float | myPitchInput |
Protected Attributes inherited from makVre::DtEntityControlLogic | |
| std::vector< std::string > | myJoystickFunctionGroups |
| DtInputLogic | myCommonInputLogic |
| std::string | myInputConfigFile |
| bool | myMouseControlEnabled |
| bool | myMouseControlSupportAllowed |
Protected Attributes inherited from makVre::DtPlayerComponent | |
| std::string | myName |
| DtInitTable | myConfig |
| DtPlayerStation * | myPlayer |
| makVrv::DtDe * | myDe |
| DtEntityResolver * | myResolver |
| DtAttributeCallbackManager | myAttributeCallbacks |
| makVre::DtCommanderHatchControlLogic::DtCommanderHatchControlLogic | ( | ) |
Constructor for DtCommanderHatchControlLogic.
Initializes the component with the name "DtCommanderHatchControlLogic" and default values. Also checks out the required VR Engage Ground license.
|
overridevirtual |
Virtual destructor for DtCommanderHatchControlLogic.
|
overridevirtual |
Initializes the component with configuration from Lua.
Sets up input handlers for "yaw", "pitch", "toggle-binoculars", and "toggle-nvg". Initializes state attributes for equipment tracking:
| player | Pointer to the player station this component belongs to |
| config | Configuration table containing initialization parameters |
Reimplemented from makVre::DtEntityControlLogic.
References makVre::DtPlayerComponent::player().
|
overridevirtual |
Performs post-initialization setup.
Initializes yaw and pitch input to zero to prevent display shaking before any input is applied. Sets up a change callback for the "usingBinoculars" state attribute.
Reimplemented from makVre::DtEntityControlLogic.
|
overridevirtual |
Updates the component state.
Called each frame to update observer yaw and pitch based on input values. Scales input by delta time and current view magnification to maintain consistent control regardless of frame rate or zoom level.
| dt | Delta time in seconds since the last tick |
Reimplemented from makVre::DtEntityControlLogic.
|
overridevirtual |
Shuts down the component.
Removes menu action message handler and usingBinoculars state attribute change callback. Also shuts down the input logic.
Reimplemented from makVre::DtEntityControlLogic.
|
overridevirtual |
Returns the component type identifier.
Reimplemented from makVre::DtEntityControlLogic.
|
virtual |
Input handler for horizontal head rotation (yaw)
Stores the input value in myYawInput for processing during tick().
| val | The yaw input value, typically from -1.0 to 1.0 |
|
virtual |
Input handler for vertical head tilt (pitch)
Stores the input value in myPitchInput for processing during tick().
| val | The pitch input value, typically from -1.0 to 1.0 |
|
virtual |
Toggles binocular use on or off.
When triggered with a value of 1.0, toggles the "usingBinoculars" state attribute. If binoculars are activated:
| val | The input value, a value of 1.0 triggers the toggle |
|
virtual |
Enables or disables binocular-specific input controls.
When enabled, loads the "binoculars" input configuration and sets up the "zoom" action handler. When disabled, unloads the binoculars input configuration.
| enabled | True to enable binocular controls, false to disable |
|
virtual |
Reduces binocular zoom level.
Sends a BinocularsZoomByMessage with a negative zoom value.
| value | The amount to zoom out (positive value) |
|
virtual |
Increases binocular zoom level.
Sends a BinocularsZoomByMessage with a positive zoom value.
| value | The amount to zoom in (positive value) |
|
virtual |
Combined input handler for binocular zoom.
Routes to zoomIn or zoomOut based on whether the input value is positive or negative.
| value | The zoom input value, positive for zoom in, negative for zoom out |
|
virtual |
Toggles night vision goggles (NVG) on or off.
When triggered with a value of 1.0, toggles the "NVG" state attribute. If NVG is activated:
| val | The input value, a value of 1.0 triggers the toggle |
|
protectedvirtual |
Handles menu action messages.
Processes menu actions, particularly the "toggleBinoculars" action which triggers the toggleBinoculars functionality.
| msg | The message to process |
|
protected |
Callback for changes to the "usingBinoculars" state attribute.
Updates the "currentEquipment" state attribute and enables/disables binocular-specific input controls based on the new value.
| usingBinoculars | The new value of the usingBinoculars state attribute |
|
protected |
Input handler logic for processing input device events.
|
protected |
Main control group name from configuration.
Used to identify the function group when sending joystick messages.
|
protected |
Current yaw input value.
Stored during input handler calls and applied during tick().
|
protected |
Current pitch input value.
Stored during input handler calls and applied during tick().