VR-Engage  2.2
Loading...
Searching...
No Matches
vreTurretActuator.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file vreTurretActuator.h
7//! \ingroup vreVrfmodel
8//! \brief Actuator for turret movement with player control awareness
9//!
10//! This file defines the DtVreTurretActuator class which extends the base
11//! turret actuator component to provide player control awareness. It suppresses
12//! normal turret control operations when the entity is under player control,
13//! allowing other systems to take over.
14#pragma once
15
16#include "vreVrfmodel/export.h"
18// #include <vreMessageManager/vreMessage.h>
19
20#include <vrfmodel/turretActuatorComponent.h>
21
22// #include <vl/hostStructs.h>
23
24namespace makVre
25{
26
27//! \brief Type identifier for the VRE turret actuator component
28const char DtVreTurretActuatorType[] = "vre-turret-actuator";
29
30//! \brief Actuator for turret movement with player control awareness
31//!
32//! DtVreTurretActuator extends the base turret actuator to provide
33//! player control awareness. When a player is controlling the entity's turret,
34//! this component suppresses its normal tick functionality, allowing the player's
35//! inputs to control the turret through other mechanisms (typically a separate
36//! player-specific actuator).
37//!
38//! This component gracefully switches between AI-controlled behavior (using the
39//! base turret actuator functionality) and player-controlled behavior (deferring
40//! to player input systems) based on the entity's control state.
41//!
42//! Uses Descriptor Type: DtHumanGunActuatorDescriptor
43
44class VREVRFMODEL_DLL DtVreTurretActuator : public DtVreSimComponent<DtTurretActuatorComponent>
45{
46public:
47 //! \brief Constructor
48 //! \param name The name of this component
49 //! \param owner The local object that owns this component
50 //! \param simManager The simulation services manager
51 //! \param desc Component descriptor with configuration parameters
52 //! \param parentRegistry Optional parent registry for reader/writer functionality
53 //!
54 //! Creates a new turret actuator component with the specified parameters.
55 //! Initializes the component to track player control state and manage turret movements.
56 DtVreTurretActuator(const DtString& name, DtLocalObject* owner, DtSimulationServices* simManager,
57 DtComponentDescriptor* desc = 0, DtReaderWriterRegistry* parentRegistry = 0);
58
59
60 //! \brief Virtual destructor
61 //!
62 //! Cleans up resources used by the turret actuator component.
63 virtual ~DtVreTurretActuator() override;
64
65 //! \brief Gets the type identifier for this component
66 //! \return String identifying the component type (DtVreTurretActuatorType)
67 //!
68 //! Implements the DtSimComponent::type() method to return the
69 //! type identifier for this component.
70 virtual const char* type() const override { return DtVreTurretActuatorType; }
71
72 //! \brief Updates the turret state each simulation frame
73 //!
74 //! Checks if a player is acting in the gunner role for this entity. If so,
75 //! the method returns immediately without making changes, allowing player
76 //! control mechanisms to handle turret movement. Otherwise, it calls the
77 //! base class tick method to function normally under CGF (Computer Generated
78 //! Forces) control, updating turret position based on AI commands.
79 virtual void tick() override;
80
81public:
82 //! \brief Factory method to create a new instance of this component
83 //! \param name The name for the new component
84 //! \param owner The local object that will own this component
85 //! \param simManager The simulation services manager
86 //! \param desc Optional component descriptor
87 //! \param parentRegistry Optional parent registry for reader/writer functionality
88 //! \return Pointer to the newly created component
89 //!
90 //! Static factory method used by the component creation system to instantiate
91 //! new instances of this component type.
92 static DtSimComponent* creator(const DtString& name, DtLocalObject* owner, DtSimulationServices* simManager,
93 DtComponentDescriptor* desc = 0, DtReaderWriterRegistry* parentRegistry = 0);
94
95private:
96 //! \brief Default constructor (not implemented)
97 //!
98 //! Default constructor is private and not implemented to prevent
99 //! creation of instances without proper initialization.
101
102 //! \brief Copy constructor (not implemented)
103 //!
104 //! Copy constructor is private and not implemented to prevent
105 //! copy construction.
107
108 //! \brief Assignment operator (not implemented)
109 //! \return Reference to this object
110 //!
111 //! Assignment operator is private and not implemented to prevent assignment.
113};
114
115} // namespace makVre
DtVreSimComponent(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
Definition vreSimComponent.h:54
DtVreTurretActuator(const DtVreTurretActuator &orig)
Copy constructor (not implemented)
virtual ~DtVreTurretActuator() override
Virtual destructor.
DtVreTurretActuator(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.
virtual const char * type() const override
Gets the type identifier for this component.
Definition vreTurretActuator.h:70
DtVreTurretActuator()
Default constructor (not implemented)
virtual void tick() override
Updates the turret state each simulation frame.
const DtVreTurretActuator & operator=(const DtVreTurretActuator &orig)
Assignment operator (not implemented)
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 DtVreTurretActuatorType[]
Type identifier for the VRE turret actuator component.
Definition vreTurretActuator.h:28
Base template class for VR-Engage simulation components.