VR-Engage  2.2
Loading...
Searching...
No Matches
vreHumanFollowController.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file vreHumanFollowController.h
7//! \ingroup vreVrfmodel
8//! \brief Controller for human entity following behavior
9//!
10//! This file defines the DtVreHumanFollowController class which models the behavior
11//! of human entities when following other entities. It dynamically recalculates
12//! movement destinations to maintain proper following positioning.
13
14#pragma once
15
16#include "vreVrfmodel/export.h"
17#include <vrfmodel/humanFollowController.h>
18#include "vreVrfModel/vreSimComponent.h"
19
20class DtStringOutputPort;
21
22namespace makVre
23{
24//! \brief Type identifier for the VRE human follow controller component
25const char DtVreHumanFollowControllerType[] = "vre-human-follow-controller";
26
27//! \brief Controller for human entity following behavior
28//!
29//! DtVreHumanFollowController models the behavior of human entities when following
30//! other entities. During each simulation frame, the destination to which the entity
31//! moves is dynamically recalculated to be in the proper position with respect to the
32//! followed entity. This allows humans to maintain formation, follow leaders, or
33//! maintain specific offset positions relative to other entities.
34//!
35//! Uses Descriptor Type: DtHumanFollowControllerDescriptor
36class VREVRFMODEL_DLL DtVreHumanFollowController : public DtVreSimComponent<DtHumanFollowController>
37{
38public:
39 //! \brief Constructor
40 //! \param name The name of this component
41 //! \param owner The local object that owns this component
42 //! \param simManager The simulation services manager
43 //! \param desc Component descriptor with configuration parameters
44 //! \param parentRegistry Optional parent registry for reader/writer functionality
45 //!
46 //! Creates a new human follow controller component with the specified parameters.
47 DtVreHumanFollowController(const DtString& name, DtLocalObject* owner, DtSimulationServices* simManager,
48 DtComponentDescriptor* desc = 0, DtReaderWriterRegistry* parentRegistry = 0);
49
50 //! \brief Virtual destructor
51 //!
52 //! Cleans up resources used by the human follow controller component.
53 virtual ~DtVreHumanFollowController() override;
54
55 //! \brief Gets the type identifier for this component
56 //! \return String identifying the component type (DtVreHumanFollowControllerType)
57 //!
58 //! Implements the DtSimComponent::type() method to return the
59 //! type identifier for this component.
60 virtual const char* type() const override;
61
62 //! \brief Updates the controller state each simulation frame
63 //!
64 //! Updates the output port with the current follow target from the PSR (Process
65 //! State Repository). During each simulation frame, this method recalculates
66 //! the destination position relative to the followed entity and updates the
67 //! entity's movement accordingly.
68 virtual void tick() override;
69
70 //! \brief Creates the input and output ports for the controller
71 //! \return True if ports are successfully created, false otherwise
72 //!
73 //! Creates additional port for the follow target point. This port is used to
74 //! output the current target entity being followed, allowing other components
75 //! to access this information.
76 virtual bool createPorts() override;
77
78 //! \brief Factory method to create a new instance of this component
79 //! \param name The name for the new component
80 //! \param owner The local object that will own this component
81 //! \param simManager The simulation services manager
82 //! \param desc Optional component descriptor
83 //! \param parentRegistry Optional parent registry for reader/writer functionality
84 //! \return Pointer to the newly created component
85 //!
86 //! Static factory method used by the component creation system to instantiate
87 //! new instances of this component type.
88 static DtSimComponent* creator(const DtString& name, DtLocalObject* owner, DtSimulationServices* simManager,
89 DtComponentDescriptor* desc = 0, DtReaderWriterRegistry* parentRegistry = 0);
90
91private:
92 //! \brief Copy constructor (not implemented)
93 //!
94 //! Copy constructor is private and not implemented to prevent
95 //! copy construction.
97
98 //! \brief Assignment operator (not implemented)
99 //! \return Reference to this object
100 //!
101 //! Assignment operator is private and not implemented to prevent assignment.
103
104protected:
105 //! \brief Output port for the current follow target entity name
106 //!
107 //! This port outputs the name of the entity currently being followed.
108 //! Other components can connect to this port to receive updates when
109 //! the follow target changes.
110 DtStringOutputPort* myFollowTargetOutputPort;
111
112 //! \brief ID for the disembark subtask
113 //!
114 //! Stores the subtask ID used for disembarkation operations when
115 //! a followed entity is being disembarked from another entity.
117};
118
119} // namespace makVre
DtVreHumanFollowController(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
Constructor.
DtVreHumanFollowController(const DtVreHumanFollowController &orig)
Copy constructor (not implemented)
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.
virtual bool createPorts() override
Creates the input and output ports for the controller.
int myDisembarkSubtaskId
ID for the disembark subtask.
Definition vreHumanFollowController.h:116
virtual const char * type() const override
Gets the type identifier for this component.
virtual void tick() override
Updates the controller state each simulation frame.
DtStringOutputPort * myFollowTargetOutputPort
Output port for the current follow target entity name.
Definition vreHumanFollowController.h:110
virtual ~DtVreHumanFollowController() override
Virtual destructor.
const DtVreHumanFollowController & operator=(const DtVreHumanFollowController &orig)
Assignment operator (not implemented)
DtVreSimComponent(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
Definition vreSimComponent.h:54
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 DtVreHumanFollowControllerType[]
Type identifier for the VRE human follow controller component.
Definition vreHumanFollowController.h:25