|
VR-Engage
2.3
|
DtHumanObserverUpdater manages the observer (camera) behavior for the human role, including handling different view modes, player postures, attachments, and special effects like NVG and flashlights. It handles positioning, orientation, and updates of the observer based on the player state.
#include <humanObserverUpdater.h>
Classes | |
| struct | Offset |
Public Member Functions | |
| DtHumanObserverUpdater () | |
| virtual | ~DtHumanObserverUpdater () override |
| 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 ObserverAttachMode | getAttachMode () |
| virtual void | onWeaponIndexChanged (int weaponIndex) |
Public Member Functions inherited from makVre::DtObserverUpdater | |
| DtObserverUpdater () | |
| virtual | ~DtObserverUpdater () override |
| virtual void | addChannelToUpdate (const std::string &windowName, const std::string &channelName) |
| virtual void | removeChannelToUpdate (const std::string &windowName, const std::string &channelName, bool restoreInitialSettings=true) |
Public Member Functions inherited from makVre::DtPlayerComponent | |
| DtPlayerComponent () | |
| virtual | ~DtPlayerComponent () |
| bool | componentReady () const |
| void | setComponentReady (bool ready) |
| virtual DtInitTickStatus | finalizeInitTick (double dt) |
| virtual void | setName (const std::string &name) |
| virtual const std::string & | name () |
| virtual DtPlayerStation & | player () |
| virtual DtAttributeHandle & | playerAttributeStore () |
| virtual const DtAttributeHandle & | playerAttributeStore () const |
| virtual const DtAttributeHandle & | ownshipState () const |
| virtual void | setExtendedData (const std::string &key, const std::string &value, DtEntityIdentifier entity=DtEntityIdentifier::nullId()) |
Protected Member Functions | |
| void | updateAttachmentOffset (double dt) |
| double | getPitch () |
| double | getYaw () |
| DtVector | getCameraOffset () |
| virtual void | updateZoomLevel () |
| DtVector | rotateVector (const DtVector &localSpineToCamera, double pitch, double yaw=0.0) |
| void | updateObserverPositionAndOrientation () |
| void | updateScopeObserver (makVrv::DtObserver *observer) |
| void | updateObserverViewMagnification (double dt) |
| virtual void | setDestinationOffset (ObserverAttachMode mode, HumanPosture posture) |
| virtual void | updateFlashlightState () |
| virtual void | updateCompassState () |
| virtual void | onNVGChanged (bool nvg) |
| virtual bool | observerPitchCheck () |
| virtual void | updateStateAttributes () override |
| virtual void | slot_observerModeSettingChanged (int mode, int setting) |
| int | buildOffsetKey (ObserverAttachMode mode, HumanPosture posture) |
Protected Member Functions inherited from makVre::DtObserverUpdater | |
| virtual void | initializeStateAttributes () override |
| virtual void | onSensorModeChanged (std::string sensorMode) |
| virtual void | onObserverModeChanged (std::string observerMode) |
| virtual void | addDefaultChannels () |
| virtual void | addVrChannels () |
| virtual bool | findChannelConfiguration (const std::string &windowName, const std::string &channelName, makVrv::DtChannelConfiguration &config) |
| virtual void | updateAllChannels () |
| virtual void | setShowCockpits (bool show) |
| virtual bool | applyConfigurationToChannel (const std::string &windowName, const std::string &channelName, const makVrv::DtChannelConfiguration &newConfig) |
| bool | firstWindowAndChannelNames (std::string &windowName, std::string &channelName) |
Additional Inherited Members | |
Protected Types inherited from makVre::DtObserverUpdater | |
| using | WindowAndChannelName = std::pair<std::string, std::string> |
| using | ChannelConfigMap = std::map<WindowAndChannelName, makVrv::DtChannelConfiguration> |
| makVre::DtHumanObserverUpdater::DtHumanObserverUpdater | ( | ) |
Default constructor.
|
overridevirtual |
Virtual destructor.
|
overridevirtual |
Initializes the observer updater component.
| player | Pointer to the player station |
| config | Configuration settings for initialization |
Reimplemented from makVre::DtObserverUpdater.
References makVre::DtPlayerComponent::player().
|
overridevirtual |
Performs post-initialization setup.
Reimplemented from makVre::DtObserverUpdater.
|
overridevirtual |
Updates the observer for the current frame.
| dt | Delta time since the last frame in seconds |
Reimplemented from makVre::DtObserverUpdater.
|
overridevirtual |
Cleans up resources when the component is being shut down.
Reimplemented from makVre::DtObserverUpdater.
|
overridevirtual |
Returns the component type identifier.
Reimplemented from makVre::DtObserverUpdater.
|
virtual |
Gets the current observer attachment mode.
|
virtual |
Handles changes to the current weapon. Triggers an update of the first-person rig to match the new weapon. Public so DtHumanRenderUpdater can update the rig when the weapon changes.
| weaponIndex | the new weapon index |
|
protected |
Updates the observer attachment offset based on current state.
| dt | Delta time since the last frame in seconds |
|
protected |
Gets the current pitch angle of the player.
|
protected |
Gets the current yaw angle of the player.
|
protected |
Gets the current camera offset from the player.
|
protectedvirtual |
Updates the target zoom level based on current observer state and equipment.
This function calculates and sets the appropriate zoom level based on the current observer attach mode, aiming state, and equipped weapon type. When aiming from first person view (and not using VR), it applies equipment-specific zoom levels:
|
protected |
Rotates a vector by the specified pitch and yaw angles.
| localSpineToCamera | Vector to rotate |
| pitch | Pitch angle in radians |
| yaw | Yaw angle in radians |
|
protected |
Updates the observer position and orientation based on current state.
|
protected |
Updates the scope observer properties.
| observer | Pointer to the scope observer to update |
|
protected |
Updates the observer view magnification (zoom)
| dt | Delta time since the last frame in seconds |
|
protectedvirtual |
Sets the destination offset for the observer.
| mode | Observer attachment mode |
| posture | Current human posture |
|
protectedvirtual |
Updates the flashlight state based on current player state.
|
protectedvirtual |
Updates the compass display state.
Updates DisplayCompass state attribute in the DtObserverModeManager, with value of the makVre::DtState attribute "compass". This shows/hides the built-in VR-Vantage compass widget.
|
protectedvirtual |
Handles changes in night vision goggles state.
| nvg | True if NVG is enabled, false otherwise |
|
protectedvirtual |
Checks if the observer pitch is at an angle above the terrain.
|
overrideprotectedvirtual |
Updates state attributes based on current observer state.
Reimplemented from makVre::DtObserverUpdater.
|
protectedvirtual |
Handles observer mode setting changes.
| mode | Observer mode that changed |
| setting | Setting that changed |
Called when an observer mode's setting changes; if it's the mode our observer is using and the setting is DisplayCompass, update corresponding state attribute.
|
inlineprotected |
Builds a lookup key for the offset map from posture and mode.
| mode | Observer attachment mode |
| posture | Human posture |
|
protected |
Pointer to the managed observer.
|
protected |
Indicates whether this component set the fixed audio listener observer.
|
protected |
Unique ID of the player element.
|
protected |
Flag indicating if the observer is currently attached.
|
protected |
Position of the spine end point.
These two should really be pulled from the gun/arms model once vrvDiguy can getLinkPosition
|
protected |
Vector from spine to camera position.
|
protected |
Distance threshold for switching to first-person view.
|
protected |
Speed of posture change transition.
|
protected |
Speed of attachment mode transition.
|
protected |
Speed of third-person aiming transition.
|
protected |
Map of observer offsets indexed by a combined posture and mode key.
|
protected |
Previous observer offset.
|
protected |
Current observer offset.
|
protected |
Target destination observer offset.
|
protected |
Flag indicating if posture has changed this frame.
|
protected |
Flag indicating that the weapon changed and hasn't been updated yet.
|
protected |
Target zoom level for the observer.
|
protected |
Interpolator for smooth zoom transitions.
|
protected |
Last known state of the flashlight.
|
protected |
Last known state of the compass.
|
protected |
Tracks the role-configured compass visibility override.
|
protected |
Indicates that the next compass update applies the role default.
|
protected |
Last known state of night vision goggles.
|
protected |
Last flashlight pitch angle.
|
protected |
Last flashlight yaw angle.
|
protected |
Flag indicating if using VR mode.
|
protected |
Interpolator for first-person model translation offset.
|
protected |
Interpolator for first-person model rotation offset.
|
protected |
Flag indicating if the player was aiming in the previous frame.
|
protected |
Name of the scope channel.
|
protected |
Scope walking pitch adjustment.
|
protected |
Maximum allowed observer pitch angle.
|
protected |
Name of the observer mode to use for NVG.
DtObserverMode to use for night vision goggles mode
|
protected |
Handle for observer attach mode.
| Attribute Store Key | observerAttachMode |
|---|
|
protected |
Handle for aiming state.
| Attribute Store Key | aiming |
|---|
|
protected |
Handle for current equipment.
| Attribute Store Key | currentEquipment |
|---|
|
protected |
Handle for current posture.
| Attribute Store Key | posture |
|---|
|
protected |
Handle indicating whether gaze pitch is active.
| Attribute Store Key | useGazePitch |
|---|
|
protected |
Handle for gaze pitch value.
| Attribute Store Key | gazePitch |
|---|
|
protected |
Handle for simulated pitch value.
| Attribute Store Key | simulatedPitch |
|---|
|
protected |
Handle indicating whether gaze yaw is active.
| Attribute Store Key | useGazeYaw |
|---|
|
protected |
Handle for gaze yaw value.
| Attribute Store Key | gazeYaw |
|---|
|
protected |
Handle for drone-control state.
| Attribute Store Key | usingDrone |
|---|
|
protected |
Handle for launcher element identifier.
| Attribute Store Key | launcherElementId |
|---|
|
protected |
Handle for binocular/launcher view magnification.
| Attribute Store Key | viewMagnification |
|---|
|
protected |
Handle for flashlight state.
| Attribute Store Key | flashlight |
|---|
|
protected |
Handle for flashlight pitch offset.
| Attribute Store Key | flashlightPitch |
|---|
|
protected |
Handle for flashlight yaw offset.
| Attribute Store Key | flashlightYaw |
|---|
|
protected |
Handle for compass state.
| Attribute Store Key | compass |
|---|
|
protected |
Handle for health value.
| Attribute Store Key | health |
|---|
|
protected |
Handle for launcher state.
| Attribute Store Key | launcherState |
|---|
|
protected |
Handle for launcher type.
| Attribute Store Key | launcherType |
|---|
|
protected |
Handle indicating whether the player carries embarked entities.
| Attribute Store Key | hasEmbarkedEntities |
|---|
|
protected |
Handle for focus-on-entity state.
| Attribute Store Key | focusOnEntity |
|---|
|
protected |
Handle for VR-enabled state.
| Attribute Store Key | vr-enabled |
|---|
|
protected |
Handle for active drone entity identifier.
| Attribute Store Key | droneEntityId |
|---|
|
protected |
Handle for current gun zoom level.
| Attribute Store Key | currentGunZoomLevel |
|---|
|
protected |
Handle for observer geocentric location.
| Attribute Store Key | observerLocation |
|---|
|
protected |
Handle for observer geocentric orientation.
| Attribute Store Key | observerOrientation |
|---|