VR-Engage  2.3
Loading...
Searching...
No Matches
gunnerControlLogic.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5//! \file gunnerControlLogic.h
6//! \brief Control logic for gunner roles in ground vehicles and weapon systems
7//! \ingroup vreCommonComponents
8
9
10#pragma once
11
14
16#include "vreUtil/initializer.h"
17
18#include <vrvCore/DtUniqueID.h>
19
20#include <matrix/vlVector.h>
21#include <matrix/vlTaitBryan.h>
22#include <vlpi/entityIdentifier.h>
23
24#include <string>
25
26namespace makVre
27{
28class DtVreMessage;
29
31
33{
34//! \ingroup RoleConfigParams
35//! \defgroup GunnerControlLogicRoleParams Gunner Control Logic Role Parameters
36//! \roleInherits{EntityControlLogicRoleParams}
37//! Configuration Options for gunner control logic role.
38//! @{
39
40//! \vreRoleParam{altRole,string,"",gunnerControlLogic,Alternate role name that can be switched to from the gunner role.}
41constexpr const char* altRole = "altRole";
42
43//! \vreRoleParam{armedProperty,string,"",gunnerControlLogic,Name of the property that controls the armed state for weapons requiring arming.}
44constexpr const char* armedProperty = "armedProperty";
45
46//! \vreRoleParam{azimuthStateAttribute,string,"mainGunAzimuth",gunnerControlLogic,State attribute name for storing the main gun azimuth angle.}
47constexpr const char* azimuthStateAttribute = "azimuthStateAttribute";
48
49//! \vreRoleParam{extendedWeaponSystems,table,"",gunnerControlLogic,Table of extended weapon system configurations for complex targeting scenarios.}
50constexpr const char* extendedWeaponSystems = "extendedWeaponSystems";
51
52//! \vreRoleParam{fireRequiresIntersection,bool,false,gunnerControlLogic,Determines whether firing requires a valid target intersection.}
53constexpr const char* fireRequiresIntersection = "fireRequiresIntersection";
54
55//! \vreRoleParam{forceResourceType,string,"",gunnerControlLogic,Forces the use of a specific resource type for weapon systems.}
56constexpr const char* forceResourceType = "forceResourceType";
57
58//! \vreRoleParam{isOverrideRole,bool,false,gunnerControlLogic,Indicates whether this gunner role operates in commander override mode.}
59constexpr const char* isOverrideRole = "isOverrideRole";
60
61//! \vreRoleParam{maxFireDegreesAzimuth,double,180.0,gunnerControlLogic,Maximum azimuth angle in degrees for weapon firing constraints.}
62constexpr const char* maxFireDegreesAzimuth = "maxFireDegreesAzimuth";
63
64//! \vreRoleParam{maxFireRange,double,10000.0,gunnerControlLogic,Maximum range in meters for weapon engagement.}
65constexpr const char* maxFireRange = "maxFireRange";
66
67//! \vreRoleParam{minFireDegreesAzimuth,double,-180.0,gunnerControlLogic,Minimum azimuth angle in degrees for weapon firing constraints.}
68constexpr const char* minFireDegreesAzimuth = "minFireDegreesAzimuth";
69
70//! \vreRoleParam{minFireRange,double,0.0,gunnerControlLogic,Minimum range in meters for weapon engagement.}
71constexpr const char* minFireRange = "minFireRange";
72
73//! \vreRoleParam{overrideSystem,string,"weapon",gunnerControlLogic,System name to use when operating in override mode.}
74constexpr const char* overrideSystem = "overrideSystem";
75
76//! \vreRoleParam{projectedTargetDistance,double,0.0,gunnerControlLogic,Distance in meters to project a fallback aim point along the observer's boresight when the center-screen intersection finds no terrain or entity (e.g. aiming into open sky). A value of 0.0 (the default) disables projection; if fireRequiresIntersection is also set the projected point takes precedence over clearing the target.}
77constexpr const char* projectedTargetDistance = "projectedTargetDistance";
78
79//! \vreRoleParam{slewToCueTargetSystem,string,"",gunnerControlLogic,Obsolete. Use DtSlewToCueControl weaponSystemToSlew instead.}
80constexpr const char* slewToCueTargetSystem = "slewToCueTargetSystem";
81
82//! \vreRoleParam{slewToCueUpdateDeltaThreshold,double,0.01,gunnerControlLogic,Obsolete. Use DtSlewToCueControl updateDeltaAngle instead.}
83constexpr const char* slewToCueUpdateDeltaThreshold = "slewToCueUpdateDeltaThreshold";
84
85//! \vreRoleParam{slewToCueUpdateRate,double,10.0,gunnerControlLogic,Obsolete. Use DtSlewToCueControl updateRate instead.}
86constexpr const char* slewToCueUpdateRate = "slewToCueUpdateRate";
87
88//! \vreRoleParam{systemName,string,"weapon",gunnerControlLogic,Primary weapon system name for this gunner role.}
89constexpr const char* systemName = "systemName";
90
91//! \vreRoleParam{zoomLevels,table,"{1,2,4,8,16,32}",gunnerControlLogic,Array of available zoom magnification levels for the gunner sight system.}
92constexpr const char* zoomLevels = "zoomLevels";
93
94//! @}
95} // namespace GunnerControlLogicConfig
96
97//! \brief Type identifier for DtGunnerControlLogic component
98constexpr const char* DtGunnerControlLogicType = "DtGunnerControlLogic";
99
100//! \brief Control logic component that handles gunner role functionality for ground vehicles
101//!
102//! DtGunnerControlLogic provides input handling and simulation logic for gunner roles,
103//! including weapon control, turret movement, firing, aiming modes, and commander override
104//! capabilities. It manages weapon selection, zoom levels, and sensor types.
106{
107public:
108 //! \brief Constructor for DtGunnerControlLogic
109 //!
110 //! Initializes component state and checks out required VRE_GROUND license
112
113 //! \brief Destructor for DtGunnerControlLogic
114 virtual ~DtGunnerControlLogic() override;
115
116 //! \brief Initializes the gunner control logic component
117 //! \param player Pointer to the player station this component belongs to
118 //! \param config Configuration table containing gunner settings
119 //! \return True if initialization succeeded, false otherwise
120 //!
121 //! Sets up joystick controls, input handlers, state attributes, zoom levels,
122 //! and extended weapon systems
123 virtual bool initialize(DtPlayerStation* player, DtInitTable& config) override;
124 //! \brief Performs post-initialization after all components are initialized
125 //! \return True if post-initialization succeeded, false otherwise
126 //!
127 //! Locates and establishes connection with the DtWeaponResourceLogic component
128 virtual bool postInitialize() override;
129 //! \brief Called every frame to update gunner control logic
130 //! \param dt Delta time since the last frame in seconds
131 //!
132 //! Updates weapon system state, handles extended weapon system targeting,
133 //! and sends firing position updates
134 virtual void tick(double dt) override;
135 //! \brief Shuts down the gunner control logic component
136 //!
137 //! Cleans up input handlers, message handlers, and disables commander override if active
138 virtual void shutdown() override;
139
140 //! \brief Returns the component type identifier
141 //! \return The component type string
142 virtual const char* type() const override;
143
144 //! \brief Input functions mapped to particular action strings in configuration
145 //!
146 //! \brief Handles weapon firing input
147 //! \param val Input value (1.0 = fire, 0.0 = stop firing)
148 virtual void fire(double val);
149 //! \brief Controls turret azimuth (horizontal rotation)
150 //! \param val Input value for azimuth rate (-1.0 to 1.0)
151 virtual void azimuth(double val);
152 //! \brief Controls turret elevation (vertical angle)
153 //! \param val Input value for elevation rate (-1.0 to 1.0)
154 virtual void elevation(double val);
155 //! \brief Controls weapon stabilization system
156 //! \param val Input value (1.0 = enable, 0.0 = disable)
157 virtual void stabilize(double val);
158 //! \brief Selects the next available weapon
159 //! \param val Input value (1.0 = select next weapon)
160 virtual void nextWeapon(double val);
161 //! \brief Selects the previous available weapon
162 //! \param val Input value (1.0 = select previous weapon)
163 virtual void previousWeapon(double val);
164 //! \brief Increases the sight magnification level
165 //! \param val Input value (1.0 = zoom in one level)
166 virtual void zoomIn(double val);
167 //! \brief Decreases the sight magnification level
168 //! \param val Input value (1.0 = zoom out one level)
169 virtual void zoomOut(double val);
170 //! \brief Cycles to the next available sensor type (visual, NVG, thermal)
171 //! \param val Input value (1.0 = select next sensor)
172 virtual void nextSensor(double val);
173 //! \brief Cycles between available aiming modes
174 virtual void cycleAimingMode();
175 //! \brief Switches between gunner and alternate role (e.g., commander RWS)
176 virtual void switchToAltRole();
177
178 //! \brief Handles input for switching to alternate role
179 //! \param val Input value (1.0 = switch role)
180 virtual void handleSwitchToAltRole(float val);
181
182 //! \brief Moves turret upward (direct control)
183 //! \param val Input value (0.0 to 1.0 for speed)
184 virtual void turretUp(float val);
185
186 //! \brief Moves turret downward (direct control)
187 //! \param val Input value (0.0 to 1.0 for speed)
188 virtual void turretDown(float val);
189
190 //! \brief Moves turret to the right (direct control)
191 //! \param val Input value (0.0 to 1.0 for speed)
192 virtual void turretRight(float val);
193
194 //! \brief Moves turret to the left (direct control)
195 //! \param val Input value (0.0 to 1.0 for speed)
196 virtual void turretLeft(float val);
197 //! \brief Controls continuous zoom level directly
198 //! \param val Input value (-1.0 to 1.0) for zoom direction and speed
199 virtual void zoom(float val);
200
201 //! Set x and y inputs for manual missile aiming.
202 virtual void missileX(double val);
203 virtual void missileY(double val);
204
205 //! Toggles armed state for a weapon that requires arming (weapons don't by default).
206 virtual void toggleArmed();
207
208 //! \brief Handles action menu messages for the gunner role
209 //! \param msg The message to handle
210 //! \return Message handling result indicating if the message was handled
211 //!
212 //! Processes menu actions like cycling weapons, sensors, aiming modes, and role switching
214
215protected:
216 //! \brief Determines if aiming should use the observer's view
217 //! \return True if aiming should use the observer's view, false otherwise
218 virtual bool aimWithObserver() const;
219
220 //! \brief Sets the commander override active state
221 //! \param active True to activate commander override, false to deactivate
222 virtual void setCommanderOverrideActive(bool active) const;
223
224 //! \brief Sends a joystick message to the entity
225 //! \param func Function name to trigger on the entity
226 //! \param val Value to send with the function (typically -1.0 to 1.0)
227 void sendJoystickMessage(const std::string& func, const double val);
228
229 //! Update missile's target point based on the x and y input. Called any time x and y are
230 //! not 0.
231 virtual void aimMissile(double x, double y);
232
233 //! @brief Returns true if the weapon can fire. Checks for range, azimuth and isArmed.
234 virtual bool canFire();
235
236 virtual void sendMissileTargetUpdate(const DtEntityIdentifier& missileId, const std::string& missileMarking,
237 const DtVector& targetPos);
238
239protected:
240 //! \brief Previously used munition name, used to detect changes
242
243 //! \brief Primary control group name for this gunner station
245
246 //! \brief Input logic that handles mapping of input actions to functions
248
249 //! \brief Name of the weapon system controlled by this gunner
250 std::string mySystemName;
251
252 //! \brief Pointer to the weapon resource logic component
254
255 //! \brief Available zoom magnification levels
256 std::vector<double> myZoomLevels;
257
258 //! \brief Current index into the zoom levels array
260
261 //! \brief Configuration table for extended weapon systems
263
264 //! \brief Configuration for the currently active extended weapon system
266
267 //! \brief Current target location for extended weapon systems
269
270 //! \brief Element ID of the current target
271 makVrv::DtElementID myTargetElement;
272
273 //! \brief Name of the alternate role to switch to
274 std::string myAltRole;
275
276 //! \brief Flag indicating if this gunner is in override mode
278
279 //! \brief Name of the system to override
280 std::string myOverrideSystem;
281
282 //! \brief Flag indicating if a weapon cycle operation is in progress
284
285 //! \brief Timer for delaying weapon cycling operations
287
288 //! Allow the configuration to specify a resource name directly.
290
291 //! \brief Distance (meters) to project a fallback aim point along the observer's boresight
292 //! when the center-screen intersection finds no terrain or entity. 0.0 disables projection.
293 //! Set via the `projectedTargetDistance` config parameter.
295
296 //! \brief True when the current extended-weapon-system target came from projecting a
297 //! fallback aim point (no real terrain/entity intersection was found). The shared
298 //! "range" attribute (from DtGunnerRangeSimLogic, which uses its own intersection) is
299 //! not meaningful in this case, so canFire() must not gate on it.
301
302 //! \vreAttrKey{resources}
304
305 //! \vreAttrKey{munitionInfo}
307
310
313
315
318
319 //! \brief Attribute handle storing the currently selected munition type for this weapon system.
320 //!
321 //! The attribute key is system-prefixed: `<systemName>.current-munition`.
322 //! \vreAttrKey{<systemName>.current-munition}
324
325 //! \brief Attribute handle storing the active sensor view index (0=Visual, 1=NVG, 2=Thermal-white, 3=Thermal-black).
326 //! \vreAttrKey{currentSensor}
328
329 //! \brief Attribute handle indicating whether the weapon is currently firing.
330 //! \vreAttrKey{firing}
332
333 //! \brief Attribute handle indicating whether the weapon system is in the armed state.
334 //!
335 //! The attribute key is configurable via the `armedProperty` config parameter.
336 //! \vreAttrKey{<armedProperty>}
338
339 //! \brief Attribute handle storing the current main-gun azimuth angle in radians.
340 //!
341 //! The attribute key is configurable via the `azimuthStateAttribute` config parameter.
342 //! Defaults to `"mainGunAzimuth"` if not specified.
343 //! \vreAttrKey{mainGunAzimuth}
345
346 //! \brief Attribute handle indicating whether a valid weapon intersection pose has been computed.
347 //! \vreAttrKey{weaponPoseValid}
349
350 //! \brief Attribute handle storing the weapon muzzle location in geocentric coordinates.
351 //! \vreAttrKey{weaponLocation}
353
354 //! \brief Attribute handle indicating whether an intersection point is required before firing.
355 //! \vreAttrKey{fireRequiresIntersection}
357
358 //! \brief Attribute handle storing the current zoom magnification level.
359 //! \vreAttrKey{zoom}
361
362 //! \brief Attribute handle indicating whether the zoom level has changed and interpolation needs updating.
363 //! \vreAttrKey{zoomChanged}
365
366 //! \brief Attribute handle storing the geocentric location of the extended weapon target.
367 //! \vreAttrKey{extendedWeaponTargetLocation}
369
370 //! \brief Attribute handle storing the scene element ID of the extended weapon target entity.
371 //! \vreAttrKey{extendedWeaponTargetElement}
373
374 //! \brief Attribute handle storing the display name of the extended weapon target entity.
375 //! \vreAttrKey{extendedWeaponTargetElementName}
377
378 //! \brief Attribute handle indicating whether the missile launcher has a locked target entity.
379 //! \vreAttrKey{launcherHasTargetEntity}
381
382 //! \brief Attribute handle indicating whether a guided missile is currently in flight.
383 //! \vreAttrKey{missileInFlight}
385
386 //! \brief Attribute handle indicating whether the player has manual control of a missile in flight.
387 //! \vreAttrKey{manualMissileControl}
389
390 //! \brief Attribute handle storing the observer's geocentric position for targeting calculations.
391 //! \vreAttrKey{observerLocation}
393
394 //! \brief Attribute handle storing the target impact point for missile guidance.
395 //! \vreAttrKey{missileTargetLocation}
397
398 //! \brief Attribute handle indicating whether the player is currently occupying the gunner's seat.
399 //! \vreAttrKey{isInGunnerSeat}
401
402 //! \brief Attribute handle storing the list of available sensor mode name strings.
403 //! \vreAttrKey{sensorModes}
405
406 //! \brief Attribute handle indicating whether indirect-fire coordinate targeting mode is active.
407 //! \vreAttrKey{usingIndirectCoordinate}
409
410 //! \brief Attribute handle storing the geocentric coordinate used for indirect fire targeting.
411 //! \vreAttrKey{indirectFireCoordinate}
413
414 //! \brief Attribute handle indicating whether the launcher supports selectable target modes.
415 //! \vreAttrKey{hasLauncherTargetModes}
417
418 //! \brief Attribute handle storing the name of the currently selected launcher target mode.
419 //! \vreAttrKey{launcherTargetMode}
421
422 //! \brief Attribute handle indicating whether the weapon system is in a fully armed and ready state.
423 //! \vreAttrKey{isArmed}
425
426 //! \brief Attribute handle storing the entity identifier of the vehicle the gunner is attached to.
427 //! \vreAttrKey{attachedTo}
429
430 //! \brief Attribute handle storing the calculated range to the current aim point.
431 //! \vreAttrKey{range}
433
434 //! \brief Attribute handle storing the weapon's current orientation in Tait-Bryan angles.
435 //! \vreAttrKey{weaponOrientation}
437
438 //! \brief Attribute handle storing the observer's current orientation in Tait-Bryan angles.
439 //! \vreAttrKey{observerOrientation}
441
442 //! \brief Attribute handle storing the name of the currently selected munition.
443 //! \vreAttrKey{current-munition}
445};
446} // namespace makVre
Handle class for safe access to attributes.
Definition attributeHandle.h:30
Type-specific handle class for attributes.
Definition attributeHandle.h:229
DtEntityControlLogic()
Constructor.
virtual void cycleAimingMode()
Cycles between available aiming modes.
DtInputLogic myInputLogic
Input logic that handles mapping of input actions to functions.
Definition gunnerControlLogic.h:247
DtAttributeHandleType< bool > myArmedStateAttr
Attribute handle indicating whether the weapon system is in the armed state.
Definition gunnerControlLogic.h:337
virtual makVre::DtVreMessageResult handleMenuMessage(makVre::DtVreMessage *msg)
Handles action menu messages for the gunner role.
virtual void shutdown() override
Shuts down the gunner control logic component.
DtAttributeHandleType< bool > myLauncherHasTargetEntityAttr
Attribute handle indicating whether the missile launcher has a locked target entity.
Definition gunnerControlLogic.h:380
DtAttributeHandleType< std::string > myCurrentMunitionAttr
Attribute handle storing the name of the currently selected munition.
Definition gunnerControlLogic.h:444
std::string myMainControlGroup
Primary control group name for this gunner station.
Definition gunnerControlLogic.h:244
double myMinRange
Definition gunnerControlLogic.h:311
double myProjectedTargetDistance
Distance (meters) to project a fallback aim point along the observer's boresight when the center-scre...
Definition gunnerControlLogic.h:294
makVre::DtInitTable myExtendedWeaponSystems
Configuration table for extended weapon systems.
Definition gunnerControlLogic.h:262
DtAttributeHandleType< bool > myFireRequiresIntersectionAttr
Attribute handle indicating whether an intersection point is required before firing.
Definition gunnerControlLogic.h:356
DtAttributeHandleType< DtEntityIdentifier > myAttachedToAttr
Attribute handle storing the entity identifier of the vehicle the gunner is attached to.
Definition gunnerControlLogic.h:428
bool myTargetIsProjected
True when the current extended-weapon-system target came from projecting a fallback aim point (no rea...
Definition gunnerControlLogic.h:300
DtAttributeHandleType< DtVector > myExtendedWeaponTargetLocationAttr
Attribute handle storing the geocentric location of the extended weapon target.
Definition gunnerControlLogic.h:368
virtual void zoomIn(double val)
Increases the sight magnification level.
DtAttributeHandleType< std::string > myExtendedWeaponTargetElementNameAttr
Attribute handle storing the display name of the extended weapon target entity.
Definition gunnerControlLogic.h:376
virtual void stabilize(double val)
Controls weapon stabilization system.
virtual bool initialize(DtPlayerStation *player, DtInitTable &config) override
Initializes the gunner control logic component.
DtAttributeHandleType< DtVector > myMissileTargetLocationAttr
Attribute handle storing the target impact point for missile guidance.
Definition gunnerControlLogic.h:396
DtAttributeHandleType< DtTaitBryan > myObserverOrientationAttr
Attribute handle storing the observer's current orientation in Tait-Bryan angles.
Definition gunnerControlLogic.h:440
DtAttributeHandleType< std::string > mySystemCurrentMunitionAttr
Attribute handle storing the currently selected munition type for this weapon system.
Definition gunnerControlLogic.h:323
DtWeaponResourceLogic * myResourceLogic
Pointer to the weapon resource logic component.
Definition gunnerControlLogic.h:253
bool myIsOverrideRole
Flag indicating if this gunner is in override mode.
Definition gunnerControlLogic.h:277
DtAttributeHandleType< bool > myZoomChangedAttr
Attribute handle indicating whether the zoom level has changed and interpolation needs updating.
Definition gunnerControlLogic.h:364
virtual void previousWeapon(double val)
Selects the previous available weapon.
double myMinGunAzimuth
Definition gunnerControlLogic.h:316
DtAttributeHandleType< bool > myHasLauncherTargetModesAttr
Attribute handle indicating whether the launcher supports selectable target modes.
Definition gunnerControlLogic.h:416
std::string myForceResourceType
Allow the configuration to specify a resource name directly.
Definition gunnerControlLogic.h:289
DtAttributeHandleType< makVrv::DtElementID > myExtendedWeaponTargetElementAttr
Attribute handle storing the scene element ID of the extended weapon target entity.
Definition gunnerControlLogic.h:372
virtual void azimuth(double val)
Controls turret azimuth (horizontal rotation)
double myMissileX
Definition gunnerControlLogic.h:308
virtual void fire(double val)
Input functions mapped to particular action strings in configuration.
virtual void missileY(double val)
DtAttributeHandleType< double > myZoomAttr
Attribute handle storing the current zoom magnification level.
Definition gunnerControlLogic.h:360
virtual void turretDown(float val)
Moves turret downward (direct control)
DtAttributeHandleType< bool > myUsingIndirectCoordinateAttr
Attribute handle indicating whether indirect-fire coordinate targeting mode is active.
Definition gunnerControlLogic.h:408
std::string myAltRole
Name of the alternate role to switch to.
Definition gunnerControlLogic.h:274
DtAttributeHandleType< std::string > myLauncherTargetModeAttr
Attribute handle storing the name of the currently selected launcher target mode.
Definition gunnerControlLogic.h:420
virtual void switchToAltRole()
Switches between gunner and alternate role (e.g., commander RWS)
virtual void turretRight(float val)
Moves turret to the right (direct control)
DtAttributeHandleType< bool > myIsArmedAttr
Attribute handle indicating whether the weapon system is in a fully armed and ready state.
Definition gunnerControlLogic.h:424
std::vector< double > myZoomLevels
Available zoom magnification levels.
Definition gunnerControlLogic.h:256
double myMaxRange
Definition gunnerControlLogic.h:312
DtAttributeHandleType< std::vector< std::string > > mySensorModesAttr
Attribute handle storing the list of available sensor mode name strings.
Definition gunnerControlLogic.h:404
DtAttributeHandleType< DtTaitBryan > myWeaponOrientationAttr
Attribute handle storing the weapon's current orientation in Tait-Bryan angles.
Definition gunnerControlLogic.h:436
virtual ~DtGunnerControlLogic() override
Destructor for DtGunnerControlLogic.
makVrv::DtElementID myTargetElement
Element ID of the current target.
Definition gunnerControlLogic.h:271
virtual bool postInitialize() override
Performs post-initialization after all components are initialized.
virtual void turretUp(float val)
Moves turret upward (direct control)
DtAttributeHandleType< bool > myManualMissileControlAttr
Attribute handle indicating whether the player has manual control of a missile in flight.
Definition gunnerControlLogic.h:388
DtAttributeHandleType< DtVector > myWeaponLocationAttr
Attribute handle storing the weapon muzzle location in geocentric coordinates.
Definition gunnerControlLogic.h:352
bool myPreviousMissileInFlight
Definition gunnerControlLogic.h:314
double myMaxGunAzimuth
Definition gunnerControlLogic.h:317
DtAttributeHandle myResourcesAttr
Definition gunnerControlLogic.h:303
DtAttributeHandleType< bool > myIsInGunnerSeatAttr
Attribute handle indicating whether the player is currently occupying the gunner's seat.
Definition gunnerControlLogic.h:400
virtual void toggleArmed()
Toggles armed state for a weapon that requires arming (weapons don't by default).
std::string myOverrideSystem
Name of the system to override.
Definition gunnerControlLogic.h:280
virtual void tick(double dt) override
Called every frame to update gunner control logic.
virtual void aimMissile(double x, double y)
Update missile's target point based on the x and y input. Called any time x and y are not 0.
virtual void turretLeft(float val)
Moves turret to the left (direct control)
DtAttributeHandle myMunitionInfoAttr
Definition gunnerControlLogic.h:306
virtual void sendMissileTargetUpdate(const DtEntityIdentifier &missileId, const std::string &missileMarking, const DtVector &targetPos)
DtAttributeHandleType< bool > myFiringAttr
Attribute handle indicating whether the weapon is currently firing.
Definition gunnerControlLogic.h:331
DtAttributeHandleType< bool > myWeaponPoseValidAttr
Attribute handle indicating whether a valid weapon intersection pose has been computed.
Definition gunnerControlLogic.h:348
DtAttributeHandleType< double > myAzimuthStateAttr
Attribute handle storing the current main-gun azimuth angle in radians.
Definition gunnerControlLogic.h:344
DtAttributeHandleType< double > myRangeAttr
Attribute handle storing the calculated range to the current aim point.
Definition gunnerControlLogic.h:432
virtual void nextSensor(double val)
Cycles to the next available sensor type (visual, NVG, thermal)
DtAttributeHandleType< bool > myMissileInFlightAttr
Attribute handle indicating whether a guided missile is currently in flight.
Definition gunnerControlLogic.h:384
DtGunnerControlLogic()
Constructor for DtGunnerControlLogic.
DtAttributeHandleType< int > myCurrentSensorAttr
Attribute handle storing the active sensor view index (0=Visual, 1=NVG, 2=Thermal-white,...
Definition gunnerControlLogic.h:327
virtual bool canFire()
Returns true if the weapon can fire. Checks for range, azimuth and isArmed.
DtAttributeHandleType< DtVector > myObserverLocationAttr
Attribute handle storing the observer's geocentric position for targeting calculations.
Definition gunnerControlLogic.h:392
virtual void missileX(double val)
Set x and y inputs for manual missile aiming.
std::string myPreviousMunitionType
Previously used munition name, used to detect changes.
Definition gunnerControlLogic.h:241
virtual bool aimWithObserver() const
Determines if aiming should use the observer's view.
virtual void setCommanderOverrideActive(bool active) const
Sets the commander override active state.
int myZoomIndex
Current index into the zoom levels array.
Definition gunnerControlLogic.h:259
DtVector myTargetLocation
Current target location for extended weapon systems.
Definition gunnerControlLogic.h:268
virtual void handleSwitchToAltRole(float val)
Handles input for switching to alternate role.
std::string mySystemName
Name of the weapon system controlled by this gunner.
Definition gunnerControlLogic.h:250
virtual const char * type() const override
Returns the component type identifier.
DtAttributeHandleType< DtVector > myIndirectFireCoordinateAttr
Attribute handle storing the geocentric coordinate used for indirect fire targeting.
Definition gunnerControlLogic.h:412
void sendJoystickMessage(const std::string &func, const double val)
Sends a joystick message to the entity.
virtual void nextWeapon(double val)
Selects the next available weapon.
virtual void zoom(float val)
Controls continuous zoom level directly.
virtual void elevation(double val)
Controls turret elevation (vertical angle)
double myDelayedCycleWeaponTimer
Timer for delaying weapon cycling operations.
Definition gunnerControlLogic.h:286
virtual void zoomOut(double val)
Decreases the sight magnification level.
makVre::DtInitTable myCurrentExtendedSystem
Configuration for the currently active extended weapon system.
Definition gunnerControlLogic.h:265
bool myCycleWeaponFlag
Flag indicating if a weapon cycle operation is in progress.
Definition gunnerControlLogic.h:283
double myMissileY
Definition gunnerControlLogic.h:309
Table-based access to Lua state for configuration data.
Definition initializer.h:38
Class for managing input configuration and handling in VR-Engage.
Definition inputLogic.h:39
virtual DtPlayerStation & player()
Gets the player station.
Class for managing the user interface for engaged roles.
Definition playerStation.h:51
Abstract base class for all VREngage messages.
Definition vreMessage.h:50
Component for managing weapon resources, equipment, and related state attributes.
Definition weaponResourceLogic.h:45
Defines the logic for controlling entities in VR-Engage.
constexpr const char * minFireRange
Definition gunnerControlLogic.h:71
constexpr const char * fireRequiresIntersection
Definition gunnerControlLogic.h:53
constexpr const char * azimuthStateAttribute
Definition gunnerControlLogic.h:47
constexpr const char * slewToCueUpdateRate
Definition gunnerControlLogic.h:86
constexpr const char * maxFireRange
Definition gunnerControlLogic.h:65
constexpr const char * armedProperty
Definition gunnerControlLogic.h:44
constexpr const char * extendedWeaponSystems
Definition gunnerControlLogic.h:50
constexpr const char * zoomLevels
\vreRoleParam{zoomLevels,table,"{1,2,4,8,16,32}",gunnerControlLogic,Array of available zoom magnifica...
Definition gunnerControlLogic.h:92
constexpr const char * maxFireDegreesAzimuth
Definition gunnerControlLogic.h:62
constexpr const char * altRole
Definition gunnerControlLogic.h:41
constexpr const char * isOverrideRole
Definition gunnerControlLogic.h:59
constexpr const char * projectedTargetDistance
Definition gunnerControlLogic.h:77
constexpr const char * systemName
Definition gunnerControlLogic.h:89
constexpr const char * minFireDegreesAzimuth
Definition gunnerControlLogic.h:68
constexpr const char * slewToCueTargetSystem
Definition gunnerControlLogic.h:80
constexpr const char * forceResourceType
Definition gunnerControlLogic.h:56
constexpr const char * slewToCueUpdateDeltaThreshold
Definition gunnerControlLogic.h:83
constexpr const char * overrideSystem
Definition gunnerControlLogic.h:74
Defines export/import macros for the vreCommonComponents library.
#define VRECOMMONCOMPONENTS_DLL
DLL export/import macro for the vreCommonComponents library.
Definition export.h:28
Provides configuration initialization for VREngage components.
Definition gunnerControlLogic.h:33
!
Definition glsVreMessageUtil.h:50
constexpr const char * DtGunnerControlLogicType
Type identifier for DtGunnerControlLogic component.
Definition gunnerControlLogic.h:98
DtVreMessageResult
Enumeration of possible message handling results.
Definition vreMessage.h:33
Defines the base class for all VREngage messages.