VR-Engage  2.2
Loading...
Searching...
No Matches
DtFpsFirstPersonUpdater.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file DtFpsFirstPersonUpdater.h
7//! \brief Defines DtFpsFirstPersonUpdater for managing first-person model view in FPS mode
8//! \ingroup vreHumanFrontend
9
10#pragma once
11
14
15#include <string>
16
17using namespace makVrv;
18
19namespace makVre
20{
21//! \brief Updater for first-person model control in FPS mode
22//!
23//! DtFpsFirstPersonUpdater extends the scene object mimic updater to provide
24//! specific control over a first-person model. It manages pitch and heading
25//! rotations of the model relative to the parent entity, with configurable
26//! pivot joints and rotation axes. This class is used primarily for the
27//! first-person view in the human role to control model orientation.
29{
30public:
31 //! \brief Constructor
32 //! \param de Reference to the display element
33 //! \param id Unique identifier for this updater
34 DtFpsFirstPersonUpdater(DtDe& de, DtUniqueID id);
35
36 //! \brief Virtual destructor
37 virtual ~DtFpsFirstPersonUpdater() override;
38
39 //! \brief Sets the pitch of the first-person model
40 //! \param pitch Pitch angle in degrees
41 //!
42 //! Controls the pitch rotation of the first-person model, relative to the
43 //! parent entity's SceneObject orientation.
44 virtual void setModelPitch(float pitch);
45
46 //! \brief Sets the heading of the first-person model
47 //! \param heading Heading angle in degrees
48 //!
49 //! Controls the heading rotation of the first-person model, relative to the
50 //! parent entity's SceneObject orientation.
51 virtual void setModelHeading(float heading);
52
53 //! \brief Sets the axis used for pitch rotation
54 //! \param axis Character representing the axis ('X', 'Y', or 'Z')
55 //!
56 //! Configuration parameter that controls which axis is used by setModelPitch.
57 //! Default is 'Y'.
58 virtual void setPitchAxis(char axis);
59
60 //! \brief Sets the base rotation for the first-person model
61 //! \param yawPitchRoll Vector containing yaw, pitch, and roll values in degrees
62 //!
63 //! Configuration parameter that sets a base rotation for the first-person model.
64 //! Values from setModelPitch and setModelHeading are added to this base rotation.
65 //! Value is relative to the parent entity's SceneObject. Default is (0,0,0).
66 virtual void setBaseRotation(DtVector yawPitchRoll);
67
68 //! \brief Sets the pivot joint for model rotation
69 //! \param jointName Name of the skeletal joint to use as pivot
70 //!
71 //! Configuration parameter that specifies the name of the skeletal joint in the
72 //! first-person model around which the model should be rotated. Default is "cervical".
73 virtual void setPivotJoint(std::string jointName);
74
75protected:
76 //! \brief Initializes the model instance
77 //! \param modelInstance Pointer to the model instance to initialize
78 virtual void initModel(DtModelInstance* modelInstance) override;
79
80 //! \brief Sets up the OSG node
81 //! \param node Pointer to the OSG node to set up
82 virtual void setupOsgNode(osg::Node* node) override;
83
84 //! \brief Updates the position and orientation for the current frame
85 //! \param tNow Current simulation time
86 virtual void updatePosition(DtTime tNow) override;
87
88 //! \brief Name of the DIGuy character model
90
91 //! \brief Current pitch angle of the model in degrees
93
94 //! \brief Current heading angle of the model in degrees
96
97 //! \brief Flag indicating if the model is in aiming pose
99
100 //! \brief Enumeration of possible rotation axes
101 enum Axis
102 {
106 };
107
108 //! \brief Current axis used for pitch rotation
110
111 //! \brief Name of the base joint for the model
112 std::string myBaseJoint;
113
114 //! \brief Name of the pivot joint for model rotation
115 std::string myPivotJoint;
116
117 //! \brief Base rotation of the model in degrees using Tait-Bryan angles
119};
120} // namespace makVre
Defines the DtSceneObjectMimicUpdater class that allows one scene object to mimic another's position.
virtual void updatePosition(DtTime tNow) override
Updates the position and orientation for the current frame.
float myModelHeading
Current heading angle of the model in degrees.
Definition DtFpsFirstPersonUpdater.h:95
std::string myDIGuyCharacterName
Name of the DIGuy character model.
Definition DtFpsFirstPersonUpdater.h:89
virtual void setupOsgNode(osg::Node *node) override
Sets up the OSG node.
virtual ~DtFpsFirstPersonUpdater() override
Virtual destructor.
float myModelPitch
Current pitch angle of the model in degrees.
Definition DtFpsFirstPersonUpdater.h:92
virtual void initModel(DtModelInstance *modelInstance) override
Initializes the model instance.
virtual void setPivotJoint(std::string jointName)
Sets the pivot joint for model rotation.
std::string myPivotJoint
Name of the pivot joint for model rotation.
Definition DtFpsFirstPersonUpdater.h:115
Axis myPitchAxis
Current axis used for pitch rotation.
Definition DtFpsFirstPersonUpdater.h:109
virtual void setBaseRotation(DtVector yawPitchRoll)
Sets the base rotation for the first-person model.
DtTaitBryan myModelRotationDegrees
Base rotation of the model in degrees using Tait-Bryan angles.
Definition DtFpsFirstPersonUpdater.h:118
Axis
Enumeration of possible rotation axes.
Definition DtFpsFirstPersonUpdater.h:102
@ X
Definition DtFpsFirstPersonUpdater.h:103
@ Z
Definition DtFpsFirstPersonUpdater.h:105
@ Y
Definition DtFpsFirstPersonUpdater.h:104
std::string myBaseJoint
Name of the base joint for the model.
Definition DtFpsFirstPersonUpdater.h:112
virtual void setModelPitch(float pitch)
Sets the pitch of the first-person model.
virtual void setPitchAxis(char axis)
Sets the axis used for pitch rotation.
DtFpsFirstPersonUpdater(DtDe &de, DtUniqueID id)
Constructor.
virtual void setModelHeading(float heading)
Sets the heading of the first-person model.
bool myModelAiming
Flag indicating if the model is in aiming pose.
Definition DtFpsFirstPersonUpdater.h:98
DtSceneObjectMimicUpdater(DtDe &de, DtUniqueID id)
Constructor for DtSceneObjectMimicUpdater.
Defines export macros for the Human Frontend library.
#define HUMAN_DLL
Definition export.h:19
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
Definition appLauncherComponent.h:28
makVrv::DtDe * de()
Gets the display element pointer used by the plugin.