VR-Engage  2.2
Loading...
Searching...
No Matches
vreHumanSetController.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file vreHumanSetController.h
7//! \ingroup vreVrfmodel
8//! \brief Controller for managing sets of human entities
9//!
10//! This file defines the DtVreHumanSetController class which extends the base set
11//! controller for human entities. It handles altitude and speed control differently
12//! for player-controlled human entities versus AI-controlled ones.
13
14#pragma once
15
16#include "vreVrfmodel/export.h"
18
19#include <vrfmodel/humanSetController.h>
20
21namespace makVre
22{
23//! \brief Type identifier for the VRE human set controller component
24const char DtVreHumanSetControllerType[] = "vre-human-set-controller";
25
26//! \brief Controller for managing sets of human entities
27//!
28//! DtVreHumanSetController extends the base set controller functionality for human entities.
29//! It handles altitude and speed control differently for player-controlled versus AI-controlled
30//! entities. The controller provides specialized handling for human-specific behaviors such as
31//! speed limitations, embarkation roles, and coordinated movement of human groups.
32
34{
35public:
36 //! \brief Constructor
37 //! \param name The name of this component
38 //! \param owner The local object that owns this component
39 //! \param simManager The simulation services manager
40 //! \param desc Component descriptor with configuration parameters
41 //! \param parentRegistry Optional parent registry for reader/writer functionality
42 //!
43 //! Creates a new human set controller component with the specified parameters.
44 DtVreHumanSetController(const DtString& name, DtLocalObject* owner, DtSimulationServices* simManager,
45 DtComponentDescriptor* desc = 0, DtReaderWriterRegistry* parentRegistry = 0);
46
47 //! \brief Virtual destructor
48 //!
49 //! Cleans up resources used by the human set controller component.
50 virtual ~DtVreHumanSetController() override;
51
52 //! \brief Callback for embarkation role messages
53 //! \param msg The message containing embarkation role information
54 //! \param usrData User data pointer, typically pointing to the instance of this class
55 //!
56 //! Static callback function invoked when an entity's embarkation role changes.
57 //! This forwards the message to the instance's processSetEngageEmbarkedRole method.
58 static void setEngageEmbarkedRoleCallback(DtSimMessage* msg, void* usrData);
59
60 //! \brief Processes embarkation role change messages
61 //! \param msg The message containing embarkation role information
62 //!
63 //! Handles messages that indicate a change in the embarkation role of an entity.
64 //! This allows the controller to adjust its behavior based on whether entities
65 //! are embarking on vehicles or disembarking from them.
66 virtual void processSetEngageEmbarkedRole(DtSimMessage* msg);
67
68 //! \brief Processes speed setting messages
69 //! \param msg The message containing speed parameters
70 //!
71 //! Overridden to clamp ordered speed to the maximum speed for AI-controlled entities.
72 //! While the VR-Engage human actuator allows speeds greater than the maximum speed for
73 //! player-controlled entities to support short-term sprinting, CGF (Computer Generated Forces)
74 //! entities are constrained to their maximum sustained speed to maintain realistic behavior.
75 virtual void processSetSpeed(DtSimMessage* msg) override;
76
77 //! \brief Factory method to create a new instance of this component
78 //! \param name The name for the new component
79 //! \param owner The local object that will own this component
80 //! \param simManager The simulation services manager
81 //! \param desc Optional component descriptor
82 //! \param parentRegistry Optional parent registry for reader/writer functionality
83 //! \return Pointer to the newly created component
84 //!
85 //! Static factory method used by the component creation system to instantiate
86 //! new instances of this component type.
87 static DtSimComponent* creator(const DtString& name, DtLocalObject* owner, DtSimulationServices* simManager,
88 DtComponentDescriptor* desc = 0, DtReaderWriterRegistry* parentRegistry = 0);
89
90 //! \brief Enables or disables autonomous action processing for the associated entity
91 //! \param enable When true autonomous actions are allowed, when false they are suppressed
92 //!
93 //! Invoked when the embarkation role for the human set changes so that the VR-Forces entity's
94 //! frame state reflects the player's engagement status. When a player is embarked and actively
95 //! engaged we suppress autonomous actions to avoid conflicts with player control; otherwise the
96 //! default autonomous behaviors remain enabled.
97 virtual void updateAutonomousActions(bool enable);
98
99private:
100 //! \brief Default constructor (not implemented)
101 //!
102 //! Default constructor is private and not implemented to prevent
103 //! creation of instances without proper initialization. Declared here because
104 //! the compiler would otherwise generate an unprotected one.
106
107 //! \brief Copy constructor (not implemented)
108 //!
109 //! Copy constructor is private and not implemented to prevent
110 //! copy construction.
112
113 //! \brief Assignment operator (not implemented)
114 //! \return Reference to this object
115 //!
116 //! Assignment operator is private and not implemented to prevent assignment.
118
119
120protected:
121 //! \brief Sets the radio receiver for simulation messages
122 //! \param radio Pointer to the simulation radio for message communication
123 //!
124 //! Overrides the base class implementation to register interest in specific
125 //! message types related to human set control, such as embarkation role changes
126 //! and speed commands. This allows the controller to react to these messages.
127 virtual void setRadio(DtSimRadio* radio) override;
128};
129} // namespace makVre
virtual void processSetEngageEmbarkedRole(DtSimMessage *msg)
Processes embarkation role change messages.
static void setEngageEmbarkedRoleCallback(DtSimMessage *msg, void *usrData)
Callback for embarkation role messages.
DtVreHumanSetController(const DtVreHumanSetController &orig)
Copy constructor (not implemented)
virtual ~DtVreHumanSetController() override
Virtual destructor.
virtual void updateAutonomousActions(bool enable)
Enables or disables autonomous action processing for the associated entity.
const DtVreHumanSetController & operator=(const DtVreHumanSetController &orig)
Assignment operator (not implemented)
virtual void processSetSpeed(DtSimMessage *msg) override
Processes speed setting messages.
DtVreHumanSetController(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
Constructor.
static DtSimComponent * creator(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
Factory method to create a new instance of this component.
DtVreHumanSetController()
Default constructor (not implemented)
virtual void setRadio(DtSimRadio *radio) override
Sets the radio receiver for simulation messages.
DtVreSetController(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
Definition vreSetController.h:76
Defines export macros for the vreVrfmodel library.
#define VREVRFMODEL_DLL
Definition export.h:22
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
const char DtVreHumanSetControllerType[]
Type identifier for the VRE human set controller component.
Definition vreHumanSetController.h:24
Template controller for handling VR-Engage entity control assignments.