VR-Engage  2.2
Loading...
Searching...
No Matches
vreDiGuyController.h
Go to the documentation of this file.
1/******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file vreDiGuyController.h
7//! \ingroup vreVrfmodel
8//! \brief Controller for DiGuy animation and behavior
9//!
10//! This file defines the DtVreDiGuyController class which extends the base DiGuy
11//! controller with VRE-specific functionality. It provides overrides for certain
12//! behaviors to better support player control and animation states. This extension
13//! corrects some logic errors in the base implementation.
14
15#pragma once
16
17#include "vreVrfmodel/export.h"
18#include "vreVrfModel/vreSimComponent.h"
19#include <vrfobjcore/humanLocalObjectFacade.h>
20#include <vrfmodel/diGuyController.h>
21
22namespace makVre
23{
24//! \brief Type identifier for the VRE DiGuy controller component
25const char DtVreDIGuyControllerType[] = "vre-di-guy-controller";
26
27//! \brief Controller for managing DiGuy human animation and behavior
28//!
29//! DtVreDiGuyController extends the base DiGuy controller with VRE-specific logic
30//! to better support player control and animation states. It provides overrides
31//! for certain behaviors to fix logic errors in the base implementation and to
32//! ensure proper animation selection based on various entity states.
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 DiGuy controller component with the specified parameters.
44 DtVreDiGuyController(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 DiGuy controller component.
50 virtual ~DtVreDiGuyController() override;
51
52 //! \brief Gets the type identifier for this component
53 //! \return String identifying the component type (DtVreDIGuyControllerType)
54 //!
55 //! Implements the DtSimComponent::type() method to return the
56 //! type identifier for this component.
57 virtual const char* type() const override;
58
59 //! \brief Factory method to create a new instance of this component
60 //! \param name The name for the new component
61 //! \param owner The local object that will own this component
62 //! \param simManager The simulation services manager
63 //! \param desc Optional component descriptor
64 //! \param parentRegistry Optional parent registry for reader/writer functionality
65 //! \return Pointer to the newly created component
66 //!
67 //! Static factory method used by the component creation system to instantiate
68 //! new instances of this component type.
69 static DtSimComponent* creator(const DtString& name, DtLocalObject* owner, DtSimulationServices* simManager,
70 DtComponentDescriptor* desc = 0, DtReaderWriterRegistry* parentRegistry = 0);
71
72 //! \brief Updates the controller state each simulation frame
73 //!
74 //! Overridden to give up animation control when the entity is player-controlled.
75 //! This allows player inputs to directly control animation states rather than
76 //! having the AI controller determine animations.
77 virtual void tick() override;
78
80
81 //! \brief Performs initialization before the first simulation tick
82 //!
83 //! Sets up initial states and configurations before the simulation begins.
84 //! This initialization is performed once before the first tick of the simulation.
85 virtual void preFirstTickInit() override;
86
87 //! \brief VRE override to handle ordered animations (currently commented out)
88 //!
89 //! This would override the base class method to obey ordered animation regardless
90 //! of posture, fixing issue VRE-3299. However, it's currently disabled because it
91 //! would prevent injured animations from showing when embarked in vehicles.
92 //! Future improvement needed: posture should not override ordered animation,
93 //! but injured or dead state should still take precedence.
94 //
95 // const DtDiGuyAnimation* chooseAnimation(DtWeaponState weaponState, DtDamageState damageState,
96 // DtLifeformStaticPosture post, const DtString& demeanor, double speed, double heading, bool debug = true) const
97 // override;
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.
105
106 //! \brief Copy constructor (not implemented)
107 //!
108 //! Copy constructor is private and not implemented to prevent
109 //! copy construction.
111
112 //! \brief Assignment operator (not implemented)
113 //! \return Reference to this object
114 //!
115 //! Assignment operator is private and not implemented to prevent assignment.
117};
118
119} // namespace makVre
virtual void preFirstTickInit() override
Performs initialization before the first simulation tick.
DtVreDiGuyController()
VRE override to handle ordered animations (currently commented out)
DtVreDiGuyController(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
Constructor.
virtual const char * type() const override
Gets the type identifier for this component.
const DtVreDiGuyController & operator=(const DtVreDiGuyController &orig)
Assignment operator (not implemented)
DtVreDiGuyController(const DtVreDiGuyController &orig)
Copy constructor (not implemented)
virtual ~DtVreDiGuyController() override
Virtual destructor.
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 void tick() override
Updates the controller state each simulation frame.
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 DtVreDIGuyControllerType[]
Type identifier for the VRE DiGuy controller component.
Definition vreDiGuyController.h:25