VR-Engage  2.2
Loading...
Searching...
No Matches
deadReckonOverrider.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file deadReckonOverrider.h
7//! \brief Defines the DtDeadReckonOverrider component that modifies dead reckoning settings for controlled entities.
8//!
9//! This component manages dead reckoning settings for an engaged entity, specifically
10//! disabling acceleration-based prediction and smoothing to provide better direct control.
11//!
12//! \ingroup vreCommonComponents
13
14#pragma once
15
17
19
20#include <vrvCore/DtUniqueID.h>
21
22namespace makVrv
23{
24//! \brief Forward declaration of the VR-Vantage scene object class
25class DtSceneObject;
26
27//! \brief Forward declaration of the VR-Vantage dead reckoning updater class
28class DtDeadReckonUpdater;
29} // namespace makVrv
30
31namespace makVre
32{
33//! \brief Forward declaration of the player station class
34class DtPlayerStation;
35
37{
38//! \ingroup RoleConfigParams
39//! \defgroup DeadReckonOverriderRoleParams Dead Reckon Overrider Role Parameters
40//! \roleInherits{PlayerComponentRoleParams}
41//! Configuration Options for dead reckon overrider role.
42//! @{
43
44// (No specific configuration parameters are currently used by DtDeadReckonOverrider.)
45
46//! @}
47} // namespace DeadReckonOverriderConfig
48
49//! \brief Type identifier for DtDeadReckonOverrider component
50constexpr const char* DtDeadReckonOverriderType = "DtDeadReckonOverrider";
51
52//! \brief Component that overrides dead reckoning settings for controlled entities
53//!
54//! The DtDeadReckonOverrider modifies dead reckoning settings for the ownship entity
55//! when it is engaged. Specifically, it disables acceleration-based prediction and
56//! smoothing to provide more responsive and accurate control when a player is
57//! directly controlling the entity.
58//!
59//! This component automatically locates the scene object and its dead reckoning updater,
60//! then modifies the settings. When the component is shut down or the scene object is
61//! deleted, the original settings are restored.
63{
64public:
65 //! \brief Constructor for DtDeadReckonOverrider
66 //!
67 //! Initializes the component with null pointers for scene object and dead reckoning updater.
69
70 //! \brief Virtual destructor for DtDeadReckonOverrider
71 virtual ~DtDeadReckonOverrider() override;
72
73 //! \brief Initializes the component with configuration from Lua
74 //!
75 //! Performs basic initialization using the parent class implementation.
76 //!
77 //! \param player Pointer to the player station this component belongs to
78 //! \param config Configuration table containing initialization parameters
79 //! \return True if initialization succeeds, false otherwise
80 virtual bool initialize(DtPlayerStation* player, DtInitTable& config) override;
81
82 //! \brief Performs post-initialization setup
83 //!
84 //! Called after all components have been initialized.
85 //!
86 //! \return True if post-initialization succeeds, false otherwise
87 virtual bool postInitialize() override;
88
89 //! \brief Updates the component state
90 //!
91 //! Attempts to find the scene object and dead reckoning updater if not already found,
92 //! then modifies the dead reckoning settings to disable acceleration-based prediction
93 //! and smoothing.
94 //!
95 //! \param dt Delta time in seconds since the last tick
96 virtual void tick(double dt) override;
97
98 //! \brief Shuts down the component
99 //!
100 //! Disconnects from the scene object's deletion signal and restores original
101 //! dead reckoning settings if the engine is not being destroyed.
102 virtual void shutdown() override;
103
104 //! \brief Returns the component type identifier
105 //! \return The component type string
106 virtual const char* type() const override;
107
108protected:
109 //! \brief Locates the scene object for the player's entity
110 //!
111 //! Attempts to find the scene object corresponding to the player's element ID.
112 //! If found, connects to the scene object's deletion signal to handle cleanup.
113 //!
114 //! \return True if the scene object was found or previously found, false otherwise
116
117 //! \brief Locates the dead reckoning updater for the scene object
118 //!
119 //! Searches through the scene object's updater chain to find a dead reckoning updater.
120 //!
121 //! \return True if the dead reckoning updater was found or previously found, false otherwise
123
124 //! \brief Signal handler for scene object deletion
125 //!
126 //! Called when the connected scene object is about to be deleted.
127 //! Performs cleanup by disconnecting signals and clearing pointers.
128 //!
129 //! \param id The unique ID of the scene object being deleted
130 void slot_sceneObjectToBeDeleted(const makVrv::DtUniqueID& id);
131
132 //! \brief Pointer to the scene object for the player's entity
133 makVrv::DtSceneObject* mySceneObject;
134
135 //! \brief Pointer to the dead reckoning updater for the scene object
136 makVrv::DtDeadReckonUpdater* myDeadReckonUpdater;
137};
138
139} // namespace makVre
makVrv::DtDeadReckonUpdater * myDeadReckonUpdater
Pointer to the dead reckoning updater for the scene object.
Definition deadReckonOverrider.h:136
virtual void tick(double dt) override
Updates the component state.
virtual bool initialize(DtPlayerStation *player, DtInitTable &config) override
Initializes the component with configuration from Lua.
bool findDeadReckonUpdater()
Locates the dead reckoning updater for the scene object.
void slot_sceneObjectToBeDeleted(const makVrv::DtUniqueID &id)
Signal handler for scene object deletion.
DtDeadReckonOverrider()
Constructor for DtDeadReckonOverrider.
virtual void shutdown() override
Shuts down the component.
makVrv::DtSceneObject * mySceneObject
Pointer to the scene object for the player's entity.
Definition deadReckonOverrider.h:133
virtual bool postInitialize() override
Performs post-initialization setup.
bool findSceneObject()
Locates the scene object for the player's entity.
virtual ~DtDeadReckonOverrider() override
Virtual destructor for DtDeadReckonOverrider.
virtual const char * type() const override
Returns the component type identifier.
Table-based access to Lua state for configuration data.
Definition initializer.h:38
virtual DtPlayerStation & player()
Gets the player station.
DtPlayerComponent()
Constructor.
Class for managing the user interface for engaged roles.
Definition playerStation.h:51
Defines export/import macros for the vreCommonComponents library.
#define VRECOMMONCOMPONENTS_DLL
DLL export/import macro for the vreCommonComponents library.
Definition export.h:28
Definition deadReckonOverrider.h:37
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
constexpr const char * DtDeadReckonOverriderType
Type identifier for DtDeadReckonOverrider component.
Definition deadReckonOverrider.h:50
Definition appLauncherComponent.h:28
Defines the DtPlayerComponent base class for VR-Engage role components.