VR-Engage  2.3
Loading...
Searching...
No Matches
humanControlLogic.h
Go to the documentation of this file.
1/****************************************************************************
2 * Copyright (c) 2026 MAK Technologies, Inc.
3 * All rights reserved.
4 ****************************************************************************/
5
6//! \file humanControlLogic.h
7//! \brief Defines DtHumanControlLogic for managing human entity controls and interactions
8//! \ingroup vreHumanFrontend
9
10#pragma once
11
16
17#include <vrvCore/DtUniqueID.h>
18
19#include <matrix/vlVector.inl> // for DtVector64::DtVector64, DtVector64::operator=
20#include <vlpi/entityIdentifier.inl> // for DtEntityIdentifier::DtEntityIdentifier, DtEntityIdentifier::operator=
21#include <vlpi/entityType.h> // for DtEntityType
22
23#include <xstring> // for string, basic_string
24#include <vector>
25
26namespace makVrv
27{
28 //! \brief Forward declaration of the observer class
29 class DtObserver;
30} // namespace makVrv
31
32namespace makVre
33{
34//! \brief Forward declaration of the human input logic class
36
37//! \brief Forward declaration of the initialization table class
38class DtInitTable;
39
40//! \brief Forward declaration of the weapon resource logic class
42
43//! \brief Forward declaration of the Qt quick overlay class
45
46//! \brief Forward declaration of the human virtual reality logic class
48
50{
51//! \ingroup RoleConfigParams
52//! \defgroup HumanControlLogicRoleParams Human Control Logic Role Parameters
53//! \roleInherits{EntityControlLogicRoleParams}
54//! Configuration Options for humanControlLogic role.
55//! @{
56
57//! \vreRoleParam{aimMultiplier,double,0.46666667,humanControlLogic,Movement speed multiplier when aiming weapons.}
58constexpr const char* aimMultiplier = "aimMultiplier";
59
60//! \vreRoleParam{aimingErrorCalcDistanceToTarget,double,1.0,humanControlLogic,Target distance in meters used for aiming error calculations.}
61constexpr const char* aimingErrorCalcDistanceToTarget = "aimingErrorCalcDistanceToTarget";
62
63//! \vreRoleParam{aimingErrorCalcMaxSpread,double,0.0,humanControlLogic,Maximum aiming spread in inches for error calculations.}
64constexpr const char* aimingErrorCalcMaxSpread = "aimingErrorCalcMaxSpread";
65
66//! \vreRoleParam{aimingImprovementPercent,double,1.0,humanControlLogic,Percentage value (0-1) for general aiming improvement.}
67constexpr const char* aimingImprovementPercent = "aimingImprovementPercent";
68
69//! \vreRoleParam{binocularsInputMultiplier,double,0.5,humanControlLogic,Input sensitivity multiplier when using binoculars.}
70constexpr const char* binocularsInputMultiplier = "binocularsInputMultiplier";
71
72//! \vreRoleParam{compassUnits,string,"Degrees",humanControlLogic,Units for compass display ("Degrees" or "NATO-MIL").}
73constexpr const char* compassUnits = "compassUnits";
74
75//! \vreRoleParam{invertPitchInput,bool,false,humanControlLogic,Whether to invert pitch input controls.}
76constexpr const char* invertPitchInput = "invertPitchInput";
77
78//! \vreRoleParam{isAllowedThirdPersonView,bool,false,humanControlLogic,Whether third-person view mode is allowed.}
79constexpr const char* isAllowedThirdPersonView = "isAllowedThirdPersonView";
80
81//! \vreRoleParam{joystickSensitivity,double,3.0,humanControlLogic,Sensitivity multiplier for joystick input.}
82constexpr const char* joystickSensitivity = "joystickSensitivity";
83
84//! \vreRoleParam{moveDelays,table,{},humanControlLogic,Table of posture change animation delays and timing.}
85constexpr const char* moveDelays = "moveDelays";
86
87//! \vreRoleParam{moveLockedPostures,table,{},humanControlLogic,Table of postures that prevent movement.}
88constexpr const char* moveLockedPostures = "moveLockedPostures";
89
90//! \vreRoleParam{postureSequence,table,{},humanControlLogic,Table defining the sequence of available postures.}
91constexpr const char* postureSequence = "postureSequence";
92
93//! \vreRoleParam{proneAimingImprovementPercent,double,1.0,humanControlLogic,Percentage value (0-1) for aiming improvement when prone.}
94constexpr const char* proneAimingImprovementPercent = "proneAimingImprovementPercent";
95
96//! \vreRoleParam{raiseGunOnAttach,bool,false,humanControlLogic,Whether to automatically raise weapon when attaching to entity.}
97constexpr const char* raiseGunOnAttach = "raiseGunOnAttach";
98
99//! \vreRoleParam{requiredAimingErrorPercent,double,0.0,humanControlLogic,Required percentage value (0-1) for aiming error calculations.}
100constexpr const char* requiredAimingErrorPercent = "requiredAimingErrorPercent";
101
102//! \vreRoleParam{runMultiplier,double,0.77777778,humanControlLogic,Movement speed multiplier when running.}
103constexpr const char* runMultiplier = "runMultiplier";
104
105//! \vreRoleParam{showCompass,bool,false,humanControlLogic,Whether to display the compass in the interface.}
106constexpr const char* showCompass = "showCompass";
107
108//! \vreRoleParam{sprintBackwardMultiplier,double,1.2,humanControlLogic,Movement speed multiplier when sprinting backward.}
109constexpr const char* sprintBackwardMultiplier = "sprintBackwardMultiplier";
110
111//! \vreRoleParam{sprintMultiplier,double,1.555556,humanControlLogic,Movement speed multiplier when sprinting forward.}
112constexpr const char* sprintMultiplier = "sprintMultiplier";
113
114//! \vreRoleParam{walkMultiplier,double,0.3,humanControlLogic,Movement speed multiplier when walking.}
115constexpr const char* walkMultiplier = "walkMultiplier";
116
117//! \vreRoleParam{weaponLockedPostures,table,{},humanControlLogic,Table of postures that prevent weapon usage.}
118constexpr const char* weaponLockedPostures = "weaponLockedPostures";
119
120//! \vreRoleParam{weaponLockedWhenMovingPostures,table,{},humanControlLogic,Table of postures that prevent weapon usage when moving.}
121constexpr const char* weaponLockedWhenMovingPostures = "weaponLockedWhenMovingPostures";
122
123//! \vreRoleParam{grenadeLaunchDelay,float,3.0,humanControlLogic,Seconds to delay grenade launch to sync with animation.}
124constexpr const char* grenadeLaunchDelay = "grenadeLaunchDelay";
125
126//! \vreRoleParam{grenadeThrowAnimation,string,"throw_grenade",humanControlLogic,Animation name to play when throwing grenades.}
127constexpr const char* grenadeThrowAnimation = "grenadeThrowAnimation";
128
129//! @}
130} // namespace HumanControlLogicConfig
131
132//! \brief Type identifier for DtHumanControlLogic component
133constexpr const char* DtHumanControlLogicType = "DtHumanControlLogic";
134
135//! \brief Control logic component for the human entity
136//!
137//! DtHumanControlLogic manages user inputs and control actions for the human entity,
138//! including movement, posture changes, weapon handling, and special actions like
139//! using equipment or interacting with the environment. It translates input commands
140//! into entity state changes and simulation actions.
142{
143public:
144
145 //! \brief Friend class declaration to allow VR logic access to protected members
147
148 //! \brief Enumeration of posture transition directions
150 POSTURE_UP, //!< Transitioning to a more upright posture
151 POSTURE_DOWN //!< Transitioning to a more prone posture
152 };
153
154 //! \brief Enumeration of compass unit types
156 DEGREES = 0, //!< Compass units in degrees (0-360)
157 NATO_MIL //!< Compass units in NATO mils (0-6400)
158 };
159
160 //! \brief Default constructor
162
163 //! \brief Virtual destructor
164 virtual ~DtHumanControlLogic() override;
165
166 //! \brief Initializes the human control logic
167 //! \param player Pointer to the player station
168 //! \param config Configuration settings for initialization
169 //! \return True if initialization was successful, false otherwise
170 virtual bool initialize(DtPlayerStation* player, DtInitTable& config) override;
171
172 //! \brief Performs post-initialization setup
173 //! \return True if post-initialization was successful, false otherwise
174 virtual bool postInitialize() override;
175
176 //! \brief Updates control logic for the current frame
177 //! \param dt Delta time since the last frame in seconds
178 virtual void tick(double dt) override;
179
180 //! \brief Cleans up resources when the component is being shut down
181 virtual void shutdown() override;
182
183 //! \brief Returns the component type identifier
184 //! \return The component type string
185 virtual const char* type() const override;
186
187 //! \brief Handles aim input
188 //! \param val Input value in the range [-1.0, 1.0]
189 virtual void aim(double val);
190
191 //! \brief Set a temporary movement lockout
192 //!
193 //! Set time in seconds during which player cannot move; set 0 to clear.
194 void setMoveLockTime(double seconds);
195
196 //! \brief Add time to a temporary movement lockout
197 //!
198 //! Add time in seconds during which player cannot move
199 void addMoveLockTime(double seconds);
200
201 //! \brief Handles forward/backward movement input
202 //! \param val Input value in the range [-1.0, 1.0], where positive is forward
203 virtual void move(double val);
204
205 //! \brief Handles left/right movement input
206 //! \param val Input value in the range [-1.0, 1.0], where positive is right
207 virtual void strafe(double val);
208 //! \brief Handles pitch (up/down looking) input
209 //! \param val Input value in the range [-1.0, 1.0], where positive is down
210 //! \param mouseInput Flag indicating if input is from mouse
211 //!
212 //! Handles pitch input, applies value scaling, and sends pitch joystick command when not gazing.
213 virtual void pitch(double val, bool mouseInput = false);
214
215 //! \brief Handles yaw (left/right looking) input
216 //! \param val Input value in the range [-1.0, 1.0], where positive is right
217 //! \param mouseInput Flag indicating if input is from mouse
218 //!
219 //! Handles yaw input, applies value scaling, and sends yaw joystick command when not gazing.
220 virtual void yaw(double val, bool mouseInput = false);
221 //! \brief Sets the pitch angle directly
222 //! \param pitch Pitch angle in degrees
223 virtual void setPitch(double pitch);
224
225 //! \brief Sets the yaw angle directly
226 //! \param yaw Yaw angle in degrees
227 virtual void setYaw(double yaw);
228
229 //! \brief Simulates yaw movement over time
230 //! \param dt Delta time since the last frame in seconds
231 virtual void simulateYaw(double dt);
232
233 //! \brief Simulates pitch movement over time
234 //! \param dt Delta time since the last frame in seconds
235 virtual void simulatePitch(double dt);
236
237 //! \brief Sets the current pitch angle for VR input
238 //! \param pitch Pitch angle in degrees
239 //! \note VRE-3178 remove once we support proper VR input
240 virtual void setCurrentPitch(double pitch);
241
242 //! \brief Sets the current heading angle for VR input
243 //! \param yaw Yaw angle in degrees
244 //! \note VRE-3178 remove once we support proper VR input
245 virtual void setCurrentHeading(double yaw);
246
247 //! \brief Syncs current heading to the entity's latest ownship orientation
249 //! \brief Turns the entity's head to look up/down
250 //!
251 //! Updates the gazePitch attribute according to the processed pitch input (myPitch).
252 virtual void gazePitch();
253
254 //! \brief Turns the entity's head to look left/right
255 //!
256 //! Updates the gazeYaw attribute according to the processed yaw input (myYaw).
257 virtual void gazeYaw();
258
259 //! \brief Gets the desired posture for the human entity
260 //! \return The current desired posture
262
263 //! \brief Sets the entity posture
264 //! \param val Input value, typically 1.0 for activation
265 //! \param posture Target posture to transition to
266 //! \param postureTransition Direction of posture transition
267 virtual void setPosture(double val, HumanPosture posture, DtPostureTransition postureTransition);
268
269 //! \brief Selects a posture based on the current state
270 //! \param val Input value, typically 1.0 for activation
271 virtual void postureSelect(double val);
272
273 //! \brief Transitions to a more upright posture
274 //! \param val Input value, typically 1.0 for activation
275 virtual void postureUp(double val);
276
277 //! \brief Transitions to a more prone posture
278 //! \param val Input value, typically 1.0 for activation
279 virtual void postureDown(double val);
280
281 //! \brief Transitions to standing posture
282 //! \param val Input value, typically 1.0 for activation
283 virtual void standUp(double val);
284
285 //! \brief Transitions to prone posture
286 //! \param val Input value, typically 1.0 for activation
287 virtual void goProne(double val);
288
289 //! \brief Transitions to kneeling posture
290 //! \param val Input value, typically 1.0 for activation
291 virtual void kneel(double val);
292
293 //! \brief Toggles binoculars equipment
294 //! \param val Input value, typically 1.0 for activation
295 virtual void toggleBinoculars(double val);
296
297 //! \brief Initiates weapon reload
298 //! \param val Input value, typically 1.0 for activation
299 virtual void reload(double val);
300
301 //! \brief Fires the current weapon
302 //! \param val Input value, typically 1.0 for activation
303 virtual void fire(double val);
304
305 //! \brief Toggles free look mode
306 //! \param val Input value, typically 1.0 for activation
307 virtual void freeLook(double val);
308
309 //! \brief Toggles the observer attachment mode
310 //! \param val Input value, typically 1.0 for activation
311 virtual void toggleObserverAttachMode(double val);
312
313 //! \brief Sets the observer attachment mode directly
314 //! \param mode The observer attachment mode to set
316
317 //! \brief Activates sprint movement
318 //! \param val Input value, typically 1.0 for activation
319 virtual void sprint(double val);
320
321 //! \brief Activates walk movement
322 //! \param val Input value, typically 1.0 for activation
323 virtual void walk(double val);
324
325 //! \brief Toggles flashlight on/off
326 //! \param val Input value, typically 1.0 for activation
327 virtual void toggleFlashlight(double val);
328
329 //! \brief Adjusts flashlight pitch upward
330 //! \param val Input value, typically 1.0 for activation
331 virtual void flashlightPitchUp(double val);
332
333 //! \brief Adjusts flashlight pitch downward
334 //! \param val Input value, typically 1.0 for activation
335 virtual void flashlightPitchDown(double val);
336
337 //! \brief Adjusts flashlight yaw leftward
338 //! \param val Input value, typically 1.0 for activation
339 virtual void flashlightYawLeft(double val);
340
341 //! \brief Adjusts flashlight yaw rightward
342 //! \param val Input value, typically 1.0 for activation
343 virtual void flashlightYawRight(double val);
344
345 //! \brief Handles first stage trigger input for weapons
346 //! \param val Input value, typically 1.0 for activation
347 virtual void firstStageTrigger(double val);
348
349 //! \brief Toggles the compass display
350 //! \param val Input value, typically 1.0 for activation
351 //!
352 //! Toggles the value of the makVre::DtState attribute "compass".
353 virtual void toggleCompass(double val);
354
355 //! \brief Toggles between compass unit types
356 //! \param val Input value, typically 1.0 for activation
357 virtual void toggleCompassUnits(double val);
358
359 //! \brief Sets the compass units directly
360 //! \param units The compass units to use
361 virtual void setCompassUnits(enum DtCompassUnits units);
362
363 //! \brief Toggles between true and magnetic north references
364 //! \param val Input value, typically 1.0 for activation
365 virtual void toggleNorthReference(double val);
366
367 //! \brief Toggles night vision goggles
368 //! \param val Input value, typically 1.0 for activation
369 virtual void toggleNVG(double val);
370
371 //! \brief Zooms in binoculars or toggles binoculars if not active
372 //! \param val Input value, typically 1.0 for activation
373 virtual void zoomInToggleBinoculars(double val);
374
375 //! \brief Zooms out binoculars or toggles binoculars if not active
376 //! \param val Input value, typically 1.0 for activation
377 virtual void zoomOutToggleBinoculars(double val);
378
379 //! \brief Toggles weapon stowed state
380 //! \param val Input value, typically 1.0 for activation
381 virtual void toggleWeaponStowed(double val);
382
383 //! \brief Toggles weapon down state
384 //! \param val Input value, typically 1.0 for activation
385 virtual void toggleWeaponDown(double val);
386
387 //! \brief Toggles HUD visibility
388 //! \param val Input value, typically 1.0 for activation
389 //!
390 //! Toggles value of state attribute "showHUD".
391 virtual void toggleHUD(double val);
392
393 //! \brief Toggles entity overlay visibility
394 //! \param val Input value, typically 1.0 for activation
395 //!
396 //! Toggles value of player attribute "showEntityOverlays".
397 virtual void toggleOverlays(double val);
398
399 //! \brief Puts the weapon in down position
400 virtual void weaponDown();
401
402 //! \brief Stows the current weapon
403 //! \param stow True to stow the weapon, false otherwise
404 virtual void weaponStow(bool stow);
405
406 //! \brief Brings the weapon to ready position
407 virtual void weaponUp();
408
409 //! \brief Cycles through weapon states (ready, down, stowed)
410 //! \param val Input value, typically 1.0 for activation
411 //!
412 //! Toggles current "attackMode" extended state data, representing
413 //! current attack mode of the launcher, top attack ("top-attack") or direct attack ("direct-attack").
414 virtual void cycleWeaponState(double val);
415
416 // Toggle current "attackMode" extended state data, representing
417 // current attack mode of the launcher, top attack ("top-attack") or direct attack ("direct-attack").
418 virtual void toggleMissileAttackMode(double val);
419
420 //! \brief Cycles through weapons or puts current weapon down
421 //! \param press True if button is pressed, false if released
422 //!
423 //! Cycles through available weapons if weapon is already in ready position,
424 //! or puts the current weapon down if in ready position and not cycling.
425 virtual void weaponCycleOrDown(bool press);
426
427 //! \brief Selects the next weapon in the inventory
428 //! \param val Input value, typically 1.0 for activation
429 //!
430 //! Cycles to the next available weapon in the entity's inventory.
431 virtual void nextWeapon(double val);
432
433 //! \brief Selects a specific weapon by index
434 //! \param index The index of the weapon to select
435 //!
436 //! Selects a specific weapon from the entity's inventory based on its index.
437 virtual void selectWeapon(int index);
438
439 //! \brief Manipulates a terrain element
440 //! \param element The terrain element to manipulate
441 //! \param action The action to perform on the element
442 //!
443 //! Performs an action on a terrain element, such as opening a door,
444 //! toggling a light switch, or operating other interactive objects.
446
447 //! \brief Toggles the left parachute control line
448 //! \param val Input value, typically 1.0 for activation
449 //!
450 //! Controls the left steering of a parachute when deployed,
451 //! causing the entity to turn left when in the air.
452 virtual void parachuteLeftToggle(double val);
453
454 //! \brief Toggles the right parachute control line
455 //! \param val Input value, typically 1.0 for activation
456 //!
457 //! Controls the right steering of a parachute when deployed,
458 //! causing the entity to turn right when in the air.
459 virtual void parachuteRightToggle(double val);
460
461 //! \brief Deploys the parachute
462 //! \param val Input value, typically 1.0 for activation
463 //!
464 //! Deploys the entity's parachute when falling, allowing for
465 //! controlled descent and safe landing.
466 virtual void parachuteDeploy(double val);
467
468 //! \brief Sets the laser designation code
469 //! \param val The four-digit laser code to set
470 //!
471 //! Sets the laser designation code used for guiding laser-guided munitions.
472 //! This code must match the code set on the munition for proper guidance.
473 virtual void setLaserCode(int val);
474
475 //! \brief Plays a DI-Guy animation action on the entity
476 //! \param diguyAction The name of the DI-Guy action to play
477 //! \param duration The duration of the animation in seconds (0 for default duration)
478 //!
479 //! Sends a VrfTaskAnimationMessage to the entity, instructing it to play the specified
480 //! DI-Guy animation action, such as waving, saluting, or other gestures and movements.
481 virtual void playDiguyAction(const std::string& diguyAction, double duration = 0);
482
483 //! \brief Plays a DI-Guy gesture on the entity
484 //! \param diguyGesture The name of the DI-Guy gesture to play
485 //!
486 //! Sends a VrfTaskGestureMessage to the entity, instructing it to play the specified
487 //! DI-Guy gesture, typically used for facial expressions and minor movements.
488 virtual void playDiguyGesture(const std::string diguyGesture);
489
490 //! \brief Sends a joystick command to a specific entity
491 //! \param id The entity identifier of the target entity
492 //! \param functionGroup The function group of the command
493 //! \param function The specific function to trigger
494 //! \param val The input value for the function
495 //! \param repeat Whether the command should be repeated (default: false)
496 //!
497 //! Sends a joystick command message to the specified entity, allowing
498 //! control of its functions via simulated joystick input.
499 virtual void sendJoystickCommand(const DtEntityIdentifier& id, const std::string& functionGroup,
500 const std::string& function, double val, bool repeat = false);
501
502 //! \brief Sends a joystick command to the controlled entity
503 //! \param functionGroup The function group of the command
504 //! \param function The specific function to trigger
505 //! \param val The input value for the function
506 //! \param repeat Whether the command should be repeated (default: false)
507 //!
508 //! Sends a joystick command message to the entity controlled by this logic component,
509 //! allowing control of its functions via simulated joystick input.
511 const std::string& functionGroup, const std::string& function, double val, bool repeat = false);
512 //! \brief Forwards a joystick command to controlled drones
513 //!
514 //! Helper comment for the sendJoystickCommand methods, indicating that they
515 //! can be used to forward commands to drones being controlled by the entity.
516
517 //! \brief Resets the entity to its initial state
518 //! \param value Input value, typically 1.0 for activation
519 //!
520 //! Resets the entity to its initial state, including position, orientation, and equipment.
521 //! This overrides the base class implementation to handle human-specific reset behavior.
522 virtual void reset(float value) override;
523
524 //! \brief Resets the entity state without changing position
525 //! \param value Input value, typically 1.0 for activation
526 //!
527 //! Resets the entity to its initial state but maintains its current position in the world.
528 //! This is useful for resetting health, equipment, or other attributes without teleporting.
529 virtual void resetInPlace(float value) override;
530
531 //! \brief Updates the DI-Guy hand item based on current state
532 //!
533 //! Updates the item held in the entity's hands based on the current weapon
534 //! or equipment selection. This affects the visual appearance of the entity.
535 virtual void updateDiGuyHandItem();
536
537 //! \brief Zooms in the weapon scope or optics
538 //! \param val Input value, typically 1.0 for activation
539 //!
540 //! Increases the zoom level of the currently equipped weapon's scope or optics,
541 //! providing a closer view of distant targets.
542 void zoomInScope(double val);
543
544 //! \brief Zooms out the weapon scope or optics
545 //! \param val Input value, typically 1.0 for activation
546 //!
547 //! Decreases the zoom level of the currently equipped weapon's scope or optics,
548 //! providing a wider field of view.
549 void zoomOutScope(double val);
550
551 //! \brief Converts a posture string to a HumanPosture enum value
552 //! \param posture String representation of the posture
553 //! \return The corresponding HumanPosture enum value
554 //!
555 //! Converts a string representation of a posture (e.g., "Standing", "Kneeling", "Prone")
556 //! to the corresponding HumanPosture enumeration value.
557 virtual HumanPosture postureFromString(const std::string& posture) const;
558
559 //! \brief Converts a HumanPosture enum value to a string
560 //! \param posture The HumanPosture enum value to convert
561 //! \return String representation of the posture
562 //!
563 //! Converts a HumanPosture enumeration value to its string representation
564 //! (e.g., "Standing", "Kneeling", "Prone").
565 virtual std::string stringForPosture(const HumanPosture posture) const;
566
567protected:
568 //! \brief Checks if the entity is dead
569 //! \return True if the entity is dead, false otherwise
570 //!
571 //! Determines whether the entity is currently dead based on its health value
572 //! and appearance bits. Used to disable certain controls when the entity is dead.
573 bool isDead();
574
575 //! \brief Checks if the player can control the entity
576 //! \return True if the player can control the entity, false otherwise
577 //!
578 //! Determines whether player input should be allowed to control the entity
579 //! based on the current state, such as health, posture, and other conditions.
581
582 //! \brief Checks if the entity is in the air
583 //! \return True if the entity is airborne, false otherwise
584 //!
585 //! Determines whether the entity is currently in the air, such as when
586 //! jumping, falling, or parachuting. Affects available controls and animations.
588
589 //! \brief Checks if the entity is aiming a launcher
590 //! \return True if aiming a launcher, false otherwise
591 //!
592 //! Determines whether the entity is currently carrying a shoulder-mounted
593 //! launcher or using a tripod-mounted launcher. Affects aiming behavior,
594 //! movement restrictions, and available actions.
595 bool isAimingLauncher() const;
596
597 //! \brief Checks whether launcher input controls should be active
598 //!
599 //! Launcher controls are active for an external launcher or while a
600 //! shoulder-mounted launcher is being aimed.
602
603 //! \brief Sets whether mouse control is enabled
604 //! \param enabled True to enable mouse control, false to disable it
605 //!
606 //! Overrides the base class implementation to handle additional setup
607 //! related to mouse pitch control for human entities.
608 virtual void setMouseControlEnabled(bool enabled) override;
609
610 //! \brief Handles simulation state messages
611 //! \param msg Pointer to the simulation state message
612 //! \return Message result indicating how the message was handled
613 //!
614 //! Processes messages containing updates to the simulation state,
615 //! such as entity positions, orientations, and other dynamic attributes.
617
618 //! \brief Handles view mode change messages
619 //! \param msg Pointer to the view mode message
620 //! \return Message result indicating how the message was handled
621 //!
622 //! Processes messages that change the view mode, such as switching
623 //! between first-person and third-person perspectives.
625
626 //! \brief Handles application focus update messages
627 //! \param msg Pointer to the focus update message
628 //! \return Message result indicating how the message was handled
629 //!
630 //! Processes messages about application focus changes. Used to disable
631 //! walking when the application loses focus, preventing stuck movement
632 //! when the ALT key release event is missed.
634
635 //! \brief Handles session play state messages
636 //! \param msg Pointer to the session play state message
637 //! \return Message result indicating how the message was handled
638 //!
639 //! Processes messages about changes to the simulation play state
640 //! (running, paused, or stopped) and updates entity controls accordingly.
642
643 //! \brief Handles changes to the current state
644 //! \param stateAttr The attribute handle for the new state
645 //!
646 //! Called when the current state changes. Provides faster response
647 //! than waiting for a message-based notification.
648 //! Updates controls based on the new state.
649 //! Restores compass visibility on engagement without hiding an already-visible compass.
650 virtual void onCurrentStateChanged(const DtAttributeHandle& stateAttr);
651
652 //! \brief Handles changes to the launcher element ID
653 //! \param launcherId The new launcher element ID
654 //!
655 //! Called when the "launcherElementId" attribute changes. Calls setupExternalLauncher
656 //! when a valid launcher ID is set, or teardownExternalLauncher when the ID is cleared.
657 //! This enables or disables launcher-specific functionality and UI elements.
658 virtual void onLauncherIdChanged(makVrv::DtElementID launcherId);
659
660 //! \brief Determines posture from appearance bits
661 //! \param entityType The entity type
662 //! \param appearanceBits The appearance bits from the entity
663 //! \return The human posture derived from appearance bits
664 //!
665 //! Extracts the current posture (standing, kneeling, prone) from the
666 //! entity's appearance bits, which encode visual state information.
667 virtual HumanPosture getPostureFromAppearance(const DtEntityType& entityType, unsigned int appearanceBits);
668
669 //! \brief Gets the currently equipped item
670 //! \return The currently active equipment type
671 //!
672 //! Determines what equipment the entity is currently using, such as
673 //! binoculars, NVGs, or weapons, based on attribute values.
675
676 //! \brief Gets the entity's health from appearance bits
677 //! \return Health value between 0.0 (dead) and 1.0 (full health)
678 //!
679 //! Extracts the current health value from the entity's appearance bits,
680 //! which include damage and injury state information.
681 virtual double getHealthFromAppearance();
682
683 //! \brief Initializes the posture-to-string mapping tables
684 //!
685 //! Sets up bidirectional mappings between HumanPosture enum values and
686 //! their string representations. Called during initialization.
687 virtual void initPostureStringMaps();
688
689 //! \brief Maps a posture enum to a string representation
690 //! \param posture The HumanPosture enum value to map
691 //! \param postureString The string representation to associate with the posture
692 //!
693 //! Adds an entry to the bidirectional mapping tables between posture
694 //! enum values and their string representations.
695 virtual void mapPostureToString(const HumanPosture posture, const std::string& postureString);
696
697 //! \brief Fires the currently equipped gun
698 //!
699 //! Handles the logic for firing a gun-type weapon, including ammunition
700 //! tracking, recoil effects, and sending the appropriate messages to the
701 //! simulation to create projectiles and effects.
702 virtual void fireGun();
703
704 //! \brief Fires the currently equipped launcher
705 //!
706 //! Handles the logic for firing a launcher-type weapon, such as rocket
707 //! launchers or missile systems, including tracking ammunition and
708 //! sending the appropriate messages to the simulation.
709 virtual void fireLauncher();
710
711 //! \brief Throws a grenade
712 //!
713 //! Handles the logic for throwing a grenade, including tracking inventory,
714 //! animation timing, and sending the appropriate messages to the simulation
715 //! to create the grenade entity.
716 virtual void throwGrenade();
717
718 //! \brief Sets up an external launcher
719 //!
720 //! Configures the control logic for using an external launcher, such as a
721 //! tripod-mounted weapon system. Sets up appropriate UI elements, control
722 //! mappings, and attribute listeners.
723 virtual void setupExternalLauncher();
724
725 //! \brief Tears down an external launcher
726 //!
727 //! Removes the configuration for an external launcher when the entity stops
728 //! using it. Cleans up UI elements, control mappings, and attribute listeners.
730
731 //! \brief Starts laser designation
732 //!
733 //! Activates the laser designator for targeting laser-guided munitions.
734 //! Sets up the necessary attributes and tracking for the laser spot.
735 virtual void startLasing();
736
737 //! \brief Updates the laser designation state
738 //!
739 //! Updates the position and state of the active laser designation spot.
740 //! Called periodically when laser designation is active.
741 virtual void updateLasingState();
742
743 //! \brief Stops laser designation
744 //!
745 //! Deactivates the laser designator and cleans up associated resources.
746 //! Removes the laser spot from the simulation.
747 virtual void stopLasing();
748
749 //! \brief Disables certain features while parachuting
750 //!
751 //! Disables features and controls that should not be available while
752 //! the entity is using a parachute, such as weapon handling or posture changes.
754
755 //! \brief Updates the weapon ready state
756 //!
757 //! Updates the state of the currently equipped weapon based on entity
758 //! attributes and conditions. Determines whether the weapon should be
759 //! ready for use or put away.
760 virtual void updateWeaponReady();
761
762 //! \brief Computes the current aiming error
763 //!
764 //! Calculates the current aiming error based on factors like posture,
765 //! movement, fatigue, and weapon type. This error affects weapon accuracy
766 //! and is used to scale the reticle in the human overlay. Must be updated
767 //! every frame for accurate visual feedback.
768 virtual void computeAimingError();
769
770 //! \brief Adds a random offset to the input aim orientation
771 //! \param aimingOrientation The aiming orientation to which the error is added
772 //!
773 //! Takes an aim orientation from the player and adds a random degree of offset
774 //! between myRequiredAimingErrorPercent and the max error determined by
775 //! computeAimingError().
776 virtual void addRandomAimingError(DtTaitBryan& aimingOrientation);
777
778 //! \brief Determines if movement should be allowed
779 //! \return True if movement should be allowed, false otherwise
780 //!
781 //! Checks various conditions to determine if the entity should be
782 //! allowed to move, such as health, posture restrictions, and current actions.
783 virtual bool shouldAllowMovement();
784
785 //! \brief Updates the move lock state
786 //!
787 //! Updates the move lock state based on current posture and conditions.
788 //! Move lock prevents the entity from moving in certain situations.
790
791 //! \brief Checks if the entity is currently moving
792 //! \return True if the entity is moving, false otherwise
793 //!
794 //! Determines whether the entity is currently in motion based on
795 //! movement inputs and velocity.
796 bool isMoving();
797
798 //! \brief Initializes the weapon index
799 //!
800 //! Sets up the initial weapon index based on the entity's configuration
801 //! and available weapons. Called during initialization.
803
804 //! \brief Sets the weapon stowed state
805 //! \param stowed True to stow the weapon, false otherwise
806 //!
807 //! Updates the weapon stowed state and related attributes.
808 //! A stowed weapon is put away completely (e.g., on the back).
809 void setWeaponStowed(bool stowed);
810
811 //! \brief Sets the weapon down state
812 //! \param down True to put the weapon down, false to bring it up
813 //!
814 //! Updates the weapon down state and related attributes.
815 //! A down weapon is lowered but still in hand (e.g., at low ready).
816 void setWeaponDown(bool down);
817
818 //! \brief Sets the weapon state directly
819 //! \param state The weapon state value to set
820 //!
821 //! Sets the weapon state directly to a specific value, bypassing
822 //! the individual stowed/down state setters.
823 void setWeaponState(int state);
824
825 //! \brief Gets the current ammunition count
826 //! \return The current ammunition count for the active weapon
827 //!
828 //! Retrieves the current ammunition count for the active weapon
829 //! from the appropriate attribute.
831
832 //! \brief Sets the gaze pitch attribute
833 //! \param pitch The pitch angle in degrees
834 //!
835 //! Updates the gazePitch attribute, which controls the up/down
836 //! orientation of the entity's head for looking.
837 void setGazePitch(double pitch);
838
839 //! \brief Sets the gaze yaw attribute
840 //! \param yaw The yaw angle in degrees
841 //!
842 //! Updates the gazeYaw attribute, which controls the left/right
843 //! orientation of the entity's head for looking.
844 void setGazeYaw(double yaw);
845
846 //! \brief Checks if third-person view is allowed
847 //! \return True if third-person view is allowed, false otherwise
848 //!
849 //! Determines if the entity is allowed to switch to third-person view
850 //! based on configuration settings in human.lua.
851 virtual bool thirdPersonAllowed();
852
853 // Commented out callback methods preserved for reference
854 // void onDiguyItemChanged(std::string);
855 // void onCanSwitchWeaponsChanged(bool);
856
857 //! \brief Handles changes to the weapon list
858 //! \param weaponList Vector of weapon names available to the entity
859 //!
860 //! Called when the list of available weapons changes. Updates the
861 //! weapon selection UI and related controls.
862 void onWeaponListChanged(const DtAttributeHandle& weaponList);
863
864 //! \brief Handles changes to the ammunition count
865 //! \param weaponResourceHandle The new ammunition count
866 //!
867 //! Called when the ammunition count for the current weapon changes.
868 //! Updates UI elements and manages weapon state if out of ammunition.
869 void onAmmoCountChanged(const DtAttributeHandle& weaponResourceHandle);
870
871 //! \brief Current ammunition resource attribute name
872 //!
873 //! Stores the name of the attribute currently being monitored for ammunition count.
874 //! \vreAttrKey{<selected-weapon-resource-attribute>}
877
878 //! \brief Handles changes to the sprinting state
879 //! \param sprinting True if the entity is sprinting, false otherwise
880 //!
881 //! Called when the sprinting state changes. Updates movement speed
882 //! modifiers and related attributes.
883 void onSprintingChanged(bool sprinting);
884
885 //! \brief Handles changes to the backward movement state
886 //! \param movingBackward True if the entity is moving backward, false otherwise
887 //!
888 //! Called when the backward movement state changes. Updates movement
889 //! speed modifiers and other movement-related attributes.
890 void onMovingBackwardChanged(bool movingBackward);
891
892 //! \brief Handles changes to the walking state
893 //! \param walking True if the entity is walking (vs running), false otherwise
894 //!
895 //! Called when the walking state changes. Updates movement speed
896 //! modifiers and related attributes.
897 void onWalkingChanged(bool walking);
898
899 //! \brief Handles changes to the aiming state
900 //! \param aiming True if the entity is aiming, false otherwise
901 //!
902 //! Called when the aiming state changes. Updates movement restrictions,
903 //! accuracy modifiers, and weapon handling attributes.
904 void onAimingChanged(bool aiming);
905
906 //! \brief Handles changes to the weapon index
907 //! \param weaponIndex The new weapon index
908 //!
909 //! Called when the selected weapon changes. Updates UI elements,
910 //! ammunition tracking, and weapon-related attributes.
911 void onWeaponIndexChanged(int weaponIndex);
912
913 //! \brief Handles changes to the posture
914 //! \param posture The new posture
915 //!
916 //! Called when the entity's posture changes. Updates movement restrictions,
917 //! accuracy modifiers, and other posture-dependent attributes.
919
920 //! \brief Handles changes to the movement capability
921 //! \param canMove True if the entity can move, false otherwise
922 //!
923 //! Called when the entity's ability to move changes. Updates movement
924 //! controls and related UI elements.
925 void onCanMoveChanged(bool canMove);
926
927 //! \brief Handles changes to the health
928 //! \param health The new health value
929 //!
930 //! Called when the entity's health changes. Updates UI elements,
931 //! movement capabilities, and other health-dependent attributes.
932 void onHealthChanged(double health);
933
934 //! \brief Handles changes to the active equipment
935 //! \param equipment The new active equipment
936 //!
937 //! Called when the entity's active equipment changes. Updates UI elements,
938 //! control modes, and equipment-dependent attributes.
940
941 //! \brief Handles changes to the binoculars state
942 //! \param usingBinoculars True if binoculars are in use, false otherwise
943 //!
944 //! Called when the entity's binoculars usage state changes. Updates
945 //! view settings, input sensitivity, and related UI elements.
946 void onBinocularsChanged(bool usingBinoculars);
947
948 //! \brief Handles changes to the forward controls state
949 //! \param forwardControls True if forward controls are enabled, false otherwise
950 //!
951 //! Called when the entity's forward controls state changes. Updates
952 //! control mappings and related UI elements.
953 void onForwardControlsChanged(bool forwardControls);
954
955 //! \brief Handles changes to the weapon state
956 //! \param weaponState The new weapon state
957 //!
958 //! Called when the entity's weapon state changes (ready, down, stowed).
959 //! Updates UI elements, control modes, and weapon-dependent attributes.
960 void onWeaponStateChanged(int weaponState);
961
962 //! \brief Handles changes to the DI-Guy action
963 //! \param action The new DI-Guy action name
964 //!
965 //! Called when the entity's DI-Guy animation action changes. Updates
966 //! control restrictions and other animation-dependent attributes.
967 void onDiGuyActionChanged(std::string action);
968
969 //! \brief Shows a QML overlay by name
970 //! \param name Name of the QML overlay to show
971 //!
972 //! Activates and displays a named QML overlay, such as a weapon scope
973 //! or other specialized UI element.
974 void showQmlOverlay(const std::string& name);
975
976 //! \brief Determines if gaze should be enabled
977 //! \param pitch True to check pitch gaze, false to check yaw gaze
978 //! \return True if gaze should be enabled, false otherwise
979 //!
980 //! Returns whether pitch/yaw gaze should be enabled according to the entity state
981 //! (e.g. weapon/launcher state, freelook/climbing enabled state, spectator observer attach mode).
982 bool shouldEnableGaze(bool pitch) const;
983
984 //! \brief Handles gaze input and updates attributes
985 //! \param pitch True to handle pitch gaze, false to handle yaw gaze
986 //! \return True if gaze is enabled and input handled, false otherwise
987 //!
988 //! Checks if gaze should be enabled and sets the useGazePitch/Yaw attribute accordingly.
989 //! Returns whether the gaze input was handled.
991
992 //! \brief Handles changes to the firepower health
993 //! \param newFirepowerHealthValue The new firepower health value
994 //!
995 //! Called when the entity's firepower health changes. This affects
996 //! aiming accuracy and weapon handling capabilities.
997 virtual void firepowerHealthChangeCallback(int newFirepowerHealthValue);
998
999 //! \brief Handles changes to the fatigue level
1000 //! \param newFatigueValue The new fatigue value
1001 //!
1002 //! Called when the entity's fatigue level changes. This affects
1003 //! movement speed, aiming accuracy, and other performance attributes.
1004 virtual void fatigueChangeCallback(double newFatigueValue);
1005
1006 //! \brief Handles changes to the percent of max speed
1007 //! \param newPercentOfMaxSpeedValue The new percent of max speed value
1008 //!
1009 //! Called when the entity's percent of maximum speed changes. This affects
1010 //! movement capabilities and is modified by fatigue and other factors.
1011 virtual void percentOfMaxSpeedChangeCallback(double newPercentOfMaxSpeedValue);
1012
1013protected:
1014 //! \brief Applies the role-configured compass units without persisting them.
1015 //! \param units The compass units to use while this component is active.
1017
1018 //! \brief Weapon resource logic component
1019 //!
1020 //! Manages weapon resources such as ammunition and available weapons.
1022
1023 //! \vreAttrKey{weaponList}
1025
1026 //! \brief Pointer to the associated observer
1027 //!
1028 //! Provides access to view-related functionality for the entity.
1029 makVrv::DtObserver* myObserver;
1030
1031 //! \brief Indicates whether role-configured compass units require restoration.
1033
1034 //! \brief Compass units active before the role-configured override.
1035 unsigned int myOriginalCompassUnits = 0;
1036
1037 //! \brief Compass units applied by the role-configured override.
1038 unsigned int myAppliedCompassUnits = 0;
1039
1040 //! \brief Human input logic component
1041 //!
1042 //! Handles input processing specific to human entities.
1044
1045 //! \brief Flag for inverting pitch input
1046 //!
1047 //! When true, pitch input is inverted (up becomes down and vice versa).
1049
1050 //! \brief Multiplier for sprint movement speed
1051 //!
1052 //! Scales forward movement speed when sprinting forward.
1054
1055 //! \brief Multiplier for backward sprint movement speed
1056 //!
1057 //! Scales backward movement speed when sprinting backward.
1059
1060 //! \brief Multiplier for running movement speed
1061 //!
1062 //! Scales movement speed when running (the default movement mode).
1064
1065 //! \brief Multiplier for walking movement speed
1066 //!
1067 //! Scales movement speed when in walking mode (slower than running).
1069
1070 //! \brief Multiplier for aiming movement speed
1071 //!
1072 //! Scales movement speed when aiming a weapon (typically slower).
1074
1075 //! \brief Last forward/backward movement input value
1076 //!
1077 //! Stores the most recent forward/backward movement input value.
1079
1080 //! \brief Last left/right strafe input value
1081 //!
1082 //! Stores the most recent left/right strafe input value.
1084
1085 //! \brief Map from posture enum to string representation
1086 //!
1087 //! Bidirectional mapping between posture enum values and their string representations.
1088 std::map<HumanPosture, std::string> myPostureToString;
1089
1090 //! \brief Map from string representation to posture enum
1091 //!
1092 //! Bidirectional mapping between string representations and posture enum values.
1093 std::map<std::string, HumanPosture> myStringToPosture;
1094
1095 //! \brief Sequence of postures for cycling
1096 //!
1097 //! Defines the order in which postures are cycled through when using posture cycling commands.
1098 std::vector<HumanPosture> myPostureSequence;
1099
1100 //! \brief Map from posture to sequence index
1101 //!
1102 //! Maps each posture to its index in the posture sequence for quick lookup.
1103 std::map<HumanPosture, int> myPostureSequenceIndex;
1104
1105 //! \brief Structure defining restrictions for each posture
1107 {
1108 //! \brief Default constructor initializing all restrictions to false
1110 : moveLocked(false)
1111 , weaponLocked(false)
1112 , weaponLockedWhenMoving(false)
1113 {
1114 }
1115
1116 //! \brief Whether movement is locked in this posture
1118
1119 //! \brief Whether weapon use is locked in this posture
1121
1122 //! \brief Whether weapon use is locked while moving in this posture
1124 };
1125
1126 //! \brief Map of posture restrictions for each posture
1127 //!
1128 //! Defines movement and weapon usage restrictions for each posture type.
1129 std::map<HumanPosture, PostureRestrictions> myPostureRestrictions;
1130
1131 //! \brief Map of animation transition timing for each posture
1132 //!
1133 //! Stores the delay times (in seconds) for transitioning into and out of each posture.
1134 //! The first value is the delay when transitioning into the posture,
1135 //! and the second value is the delay when transitioning out of the posture.
1136 std::map<HumanPosture, std::pair<double /* delay into */, double /* out of */>> myPostureAnimationWaitTimes;
1137
1138 //! \brief Last posture transition direction
1139 //!
1140 //! Stores the direction of the last posture transition (up or down).
1142
1143 //! \brief Expected posture after transition completes
1144 //!
1145 //! The posture that the entity is transitioning to or expected to reach.
1147
1148 //! \brief Desired posture requested by user input
1149 //!
1150 //! The posture that was requested through user input, which may differ
1151 //! from the expected posture during transitions.
1153
1154 //! \brief Last stable posture
1155 //!
1156 //! The last fully-established posture before any current transition.
1158
1159 //! \brief Timeout for posture command processing
1160 //!
1161 //! Time remaining (in seconds) before a posture command expires if not completed.
1163
1164 //! \brief Posture animation wait timer
1165 //!
1166 //! Time remaining (in seconds) to wait for the current posture animation to complete.
1168
1169 //! \brief Timed move lock time remaining
1170 //!
1171 //! Time in seconds remaining in temporary movement lockout.
1172 double myMoveLockTimer = 0.0;
1173
1174 //! \brief Move lock active flag
1175 //!
1176 //! Indicates whether movement is currently locked due to posture constraints
1177 //! or other restrictions.
1179
1180 //! \brief Target weapon state to transition to
1181 //!
1182 //! The weapon state that the entity is transitioning to after any delays.
1184
1185 //! \brief Timer for delayed weapon state changes
1186 //!
1187 //! Time remaining (in seconds) before a delayed weapon state change occurs.
1189
1190 //! \brief Joystick input sensitivity multiplier
1191 //!
1192 //! Controls the sensitivity of joystick inputs for movement and aiming.
1194
1195 //! \brief Current fatigue level
1196 //!
1197 //! Stores the current fatigue value, which affects aiming accuracy and movement speed.
1198 //! Higher values indicate greater fatigue and worse performance.
1200
1201 //! \brief Current firepower health value
1202 //!
1203 //! Stores the current firepower health value, which affects aiming accuracy.
1204 //! Lower values indicate degraded weapon handling capability.
1206
1207 //! \brief Current percentage of maximum movement speed
1208 //!
1209 //! Represents the current percentage of maximum speed available to the entity.
1210 //! Decreases as fatigue increases, limiting maximum movement speed.
1212
1213 //! \brief Maximum aiming error in radians
1214 //!
1215 //! The maximum half-angle of aiming error in radians. This is typically negative
1216 //! to produce the full spread of possible aiming error.
1218
1219 //! \brief Current aiming error as a percentage of maximum
1220 //!
1221 //! The current aiming error expressed as a percentage of the maximum possible error.
1222 //! Affected by posture, movement, fatigue, and other factors.
1224
1225 //! \brief Minimum required aiming error percentage
1226 //!
1227 //! The minimum error percentage that is always applied to ensure some spread
1228 //! in shots, preventing unrealistically perfect accuracy.
1230
1231 //! \brief Aiming improvement percentage in prone position
1232 //!
1233 //! The percentage by which aiming accuracy improves when in the prone position.
1234 //! This reduces the effective aiming error.
1236
1237 //! \brief Aiming improvement percentage when aiming
1238 //!
1239 //! The percentage by which aiming accuracy improves when using the weapon's
1240 //! aiming capability (e.g., iron sights, optics).
1242
1243 //! \brief Current entity heading in degrees
1244 //!
1245 //! The current heading (yaw) angle of the entity in world space, in degrees.
1247
1248 //! \brief Current entity pitch in degrees
1249 //!
1250 //! The current pitch angle of the entity in world space, in degrees.
1252
1253 //! \brief Yaw rate in degrees per second
1254 //!
1255 //! The rate at which the entity's yaw angle changes when turning, in degrees per second.
1257
1258 //! \brief Pitch rate in degrees per second
1259 //!
1260 //! The rate at which the entity's pitch angle changes when looking up/down, in degrees per second.
1262
1263 //! \brief Turning rate modifier
1264 //!
1265 //! A modifier applied to the turning rate under various conditions.
1267
1268 //! \brief Current input-driven yaw offset
1269 //!
1270 //! The current yaw offset resulting from user input, relative to the entity's base orientation.
1271 double myYaw;
1272
1273 //! \brief Current input-driven pitch offset
1274 //!
1275 //! The current pitch offset resulting from user input, relative to the entity's base orientation.
1276 double myPitch;
1277
1278 //! \brief Flag indicating heading initialization
1279 //!
1280 //! When true, indicates that the entity's heading has been initialized.
1282
1283 //! \brief Flag to force orientation update
1284 //!
1285 //! When true, forces an update to the entity's orientation even if other conditions
1286 //! would normally prevent it. Temporary solution for VR input (VRE-3178).
1288
1289 //! \brief Flag for sending gaze angles
1290 //!
1291 //! When true, enables sending of gaze angle updates to the entity.
1293
1294 //! \brief Flag for two-stage fire mode
1295 //!
1296 //! When true, indicates that the current weapon uses a two-stage firing process,
1297 //! such as missile launchers with target lock before firing.
1299
1300 //! \brief Seconds to delay launch to sync with throwing animation
1302
1303 //! \brief Name of animation to use when throwing grenades
1304 std::string myGrenadeThrowAnimation = "throw_grenade";
1305
1306 //! \brief Current laser designation target location
1307 //!
1308 //! The world position of the current laser designation target point.
1310
1311 //! \brief Input sensitivity multiplier when using binoculars
1312 //!
1313 //! Scales joystick and mouse pitch/yaw inputs while using binoculars.
1314 //! Corresponds to lua configuration variable "binocularsInputMultiplier".
1315 //! Defaults to 0.5 to provide finer control while using binoculars.
1317
1318 //! \brief Cached observer attach mode before menu state
1319 //!
1320 //! Stores the observer attach mode at the time we enter the menu state.
1321 //! Used to restore the observer attach mode upon exiting menu state
1322 //! (while in the menu state, we force third person mode).
1324
1325 //! \brief Cached compass visibility state before menu state
1326 //!
1327 //! Initially set from showCompass, then caches visibility when entering the menu state.
1328 //! Used to restore the compass visibility when exiting the menu state.
1330
1331 //! \brief Currently active scope overlay
1332 //!
1333 //! The DtQtQuickOverlay scope currently in use. It may or may not be null
1334 //! over the lifetime of a player. For example, with shoulder mounted launchers,
1335 //! there may be a valid pointer when the launcher is raised, but once lowered,
1336 //! the pointer will be set to null again.
1338
1339 //! \brief Handle for current human posture.
1340 //! \vreAttrKey{posture}
1342
1343 //! \brief Handle for current weapon state.
1344 //! \vreAttrKey{weaponState}
1346
1347 //! \brief Handle for aiming state.
1348 //! \vreAttrKey{aiming}
1350
1351 //! \brief Handle indicating whether the player is controlling a drone.
1352 //! \vreAttrKey{usingDrone}
1354
1355 //! \brief Handle for movement enable state.
1356 //! \vreAttrKey{canMove}
1358
1359 //! \brief Handle for weapon usage enable state.
1360 //! \vreAttrKey{canUseWeapons}
1362
1363 //! \brief Handle for launcher element identifier.
1364 //! \vreAttrKey{launcherElementId}
1366
1367 //! \brief Handle for launcher state.
1368 //! \vreAttrKey{launcherState}
1370
1371 //! \brief Handle for free-look state.
1372 //! \vreAttrKey{freeLook}
1374
1375 //! \brief Handle for climbing state.
1376 //! \vreAttrKey{climbing}
1378
1379 //! \brief Handle indicating whether gaze pitch controls are active.
1380 //! \vreAttrKey{useGazePitch}
1382
1383 //! \brief Handle indicating whether gaze yaw controls are active.
1384 //! \vreAttrKey{useGazeYaw}
1386
1387 //! \brief Handle for gaze pitch value.
1388 //! \vreAttrKey{gazePitch}
1390
1391 //! \brief Handle for gaze yaw value.
1392 //! \vreAttrKey{gazeYaw}
1394
1395 //! \brief Handle for mouse-control state.
1396 //! \vreAttrKey{usingMouse}
1398
1399 //! \brief Handle for health value.
1400 //! \vreAttrKey{health}
1402
1403 //! \brief Handle for sprinting state.
1404 //! \vreAttrKey{sprinting}
1406
1407 //! \brief Handle for walking state.
1408 //! \vreAttrKey{walking}
1410
1411 //! \brief Handle for moving-backward state.
1412 //! \vreAttrKey{movingBackward}
1414
1415 //! \brief Handle for weapon-ready state.
1416 //! \vreAttrKey{weaponReady}
1418
1419 //! \brief Handle for current equipment selection.
1420 //! \vreAttrKey{currentEquipment}
1422
1423 //! \brief Handle for current weapon index.
1424 //! \vreAttrKey{weaponIndex}
1426
1427 //! \brief Handle indicating whether a laser is available.
1428 //! \vreAttrKey{HasLaser}
1430
1431 //! \brief Handle for laser on/off state.
1432 //! \vreAttrKey{laserOn}
1434
1435 //! \brief Handle for binocular usage state.
1436 //! \vreAttrKey{usingBinoculars}
1438
1439 //! \brief Handle for desired posture override.
1440 //! \vreAttrKey{desiredPosture}
1442
1443 //! \brief Handle for simulated heading value.
1444 //! \vreAttrKey{simulatedHeading}
1446
1447 //! \brief Handle for simulated pitch value.
1448 //! \vreAttrKey{simulatedPitch}
1450
1451 //! \brief Handle for weapon aim error percentage.
1452 //! \vreAttrKey{weaponAimErrorPercentage}
1454
1455 //! \brief Handle for observer attach mode.
1456 //! \vreAttrKey{observerAttachMode}
1458
1459 //! \brief Handle for night-vision state.
1460 //! \vreAttrKey{NVG}
1462
1463 //! \brief Handle for flashlight state.
1464 //! \vreAttrKey{flashlight}
1466
1467 //! \brief Handle for compass visibility state.
1468 //! \vreAttrKey{compass}
1470
1471 //! \brief Handle for current sensor mode name.
1472 //! \vreAttrKey{sensorMode}
1474
1475 //! \brief Handle for previous sensor mode name.
1476 //! \vreAttrKey{lastSensorMode}
1478
1479};
1480} // namespace makVre
Scoped attribute change callback wrapper.
Definition attributeCallback.h:101
Handle class for safe access to attributes.
Definition attributeHandle.h:30
Type-specific handle class for attributes.
Definition attributeHandle.h:229
DtEntityControlLogic()
Constructor.
bool myInvertPitch
Flag for inverting pitch input.
Definition humanControlLogic.h:1048
DtAttributeHandleType< double > myWeaponAimErrorPercentageAttr
Handle for weapon aim error percentage.
Definition humanControlLogic.h:1453
virtual void fireGun()
Fires the currently equipped gun.
enum DtCompassUnits { DEGREES=0, NATO_MIL } DtCompassUnits
Enumeration of compass unit types.
Definition humanControlLogic.h:155
virtual void playDiguyGesture(const std::string diguyGesture)
Plays a DI-Guy gesture on the entity.
virtual void nextWeapon(double val)
Selects the next weapon in the inventory.
double myJoystickSensitivity
Joystick input sensitivity multiplier.
Definition humanControlLogic.h:1193
std::map< std::string, HumanPosture > myStringToPosture
Map from string representation to posture enum.
Definition humanControlLogic.h:1093
virtual void setCurrentPitch(double pitch)
Sets the current pitch angle for VR input.
virtual void teardownExternalLauncher()
Tears down an external launcher.
double myPostureCommandTimeout
Timeout for posture command processing.
Definition humanControlLogic.h:1162
enum DtPostureTransition { POSTURE_UP, POSTURE_DOWN } DtPostureTransition
Enumeration of posture transition directions.
Definition humanControlLogic.h:149
virtual HumanPosture desiredPosture() const
Gets the desired posture for the human entity.
virtual void stopLasing()
Stops laser designation.
void zoomInScope(double val)
Zooms in the weapon scope or optics.
void onWeaponIndexChanged(int weaponIndex)
Handles changes to the weapon index.
virtual void updateDiGuyHandItem()
Updates the DI-Guy hand item based on current state.
DtAttributeHandleType< LauncherState > myLauncherStateAttr
Handle for launcher state.
Definition humanControlLogic.h:1369
virtual void weaponStow(bool stow)
Stows the current weapon.
DtAttributeHandleType< HumanPosture > myDesiredPostureAttr
Handle for desired posture override.
Definition humanControlLogic.h:1441
virtual void flashlightPitchUp(double val)
Adjusts flashlight pitch upward.
DtPostureTransition myLastPostureTransition
Last posture transition direction.
Definition humanControlLogic.h:1141
virtual void setCurrentHeading(double yaw)
Sets the current heading angle for VR input.
virtual makVre::DtVreMessageResult handleSessionPlayState(makVre::DtVreMessage *msg)
Handles session play state messages.
virtual void toggleFlashlight(double val)
Toggles flashlight on/off.
virtual std::string stringForPosture(const HumanPosture posture) const
Converts a HumanPosture enum value to a string.
DtAttributeHandleType< std::string > mySensorModeAttr
Handle for current sensor mode name.
Definition humanControlLogic.h:1473
unsigned int myOriginalCompassUnits
Compass units active before the role-configured override.
Definition humanControlLogic.h:1035
virtual void walk(double val)
Activates walk movement.
double myLastMoveValue
Last forward/backward movement input value.
Definition humanControlLogic.h:1078
virtual void freeLook(double val)
Toggles free look mode.
DtAttributeHandleType< bool > myLaserOnAttr
Handle for laser on/off state.
Definition humanControlLogic.h:1433
bool myMoveLockActive
Move lock active flag.
Definition humanControlLogic.h:1178
bool mySendGazeAngles
Flag for sending gaze angles.
Definition humanControlLogic.h:1292
virtual void firstStageTrigger(double val)
Handles first stage trigger input for weapons.
virtual void selectWeapon(int index)
Selects a specific weapon by index.
virtual void kneel(double val)
Transitions to kneeling posture.
virtual Equipment getCurrentEquipment()
Gets the currently equipped item.
bool launcherControlsEnabled() const
Checks whether launcher input controls should be active.
double myYaw
Current input-driven yaw offset.
Definition humanControlLogic.h:1271
virtual void reload(double val)
Initiates weapon reload.
void onAmmoCountChanged(const DtAttributeHandle &weaponResourceHandle)
Handles changes to the ammunition count.
virtual void weaponUp()
Brings the weapon to ready position.
bool myInitialCompassUnitsOverrideActive
Indicates whether role-configured compass units require restoration.
Definition humanControlLogic.h:1032
int myEventualWeaponState
Target weapon state to transition to.
Definition humanControlLogic.h:1183
virtual HumanPosture getPostureFromAppearance(const DtEntityType &entityType, unsigned int appearanceBits)
Determines posture from appearance bits.
virtual void toggleNVG(double val)
Toggles night vision goggles.
void onWalkingChanged(bool walking)
Handles changes to the walking state.
virtual void toggleOverlays(double val)
Toggles entity overlay visibility.
virtual void parachuteRightToggle(double val)
Toggles the right parachute control line.
virtual void strafe(double val)
Handles left/right movement input.
virtual void toggleCompassUnits(double val)
Toggles between compass unit types.
DtAttributeHandleType< HumanPosture > myPostureAttr
Handle for current human posture.
Definition humanControlLogic.h:1341
virtual void shutdown() override
Cleans up resources when the component is being shut down.
virtual makVre::DtVreMessageResult handleSimState(makVre::DtVreMessage *msg) override
Handles simulation state messages.
DtHumanInputLogic * myHumanInputLogic
Human input logic component.
Definition humanControlLogic.h:1043
virtual void updateWeaponReady()
Updates the weapon ready state.
double mySprintBackwardMultiplier
Multiplier for backward sprint movement speed.
Definition humanControlLogic.h:1058
void onWeaponStateChanged(int weaponState)
Handles changes to the weapon state.
std::map< HumanPosture, std::pair< double, double > > myPostureAnimationWaitTimes
Map of animation transition timing for each posture.
Definition humanControlLogic.h:1136
std::string myGrenadeThrowAnimation
Name of animation to use when throwing grenades.
Definition humanControlLogic.h:1304
void onSprintingChanged(bool sprinting)
Handles changes to the sprinting state.
virtual void zoomInToggleBinoculars(double val)
Zooms in binoculars or toggles binoculars if not active.
virtual void flashlightPitchDown(double val)
Adjusts flashlight pitch downward.
bool isAimingLauncher() const
Checks if the entity is aiming a launcher.
virtual void toggleHUD(double val)
Toggles HUD visibility.
DtVector myLasingLocation
Current laser designation target location.
Definition humanControlLogic.h:1309
bool isDead()
Checks if the entity is dead.
virtual void toggleMissileAttackMode(double val)
virtual void setObserverAttachMode(ObserverAttachMode mode)
Sets the observer attachment mode directly.
double getCurrentAmmo()
Gets the current ammunition count.
float myGrenadeLaunchDelay
Seconds to delay launch to sync with throwing animation.
Definition humanControlLogic.h:1301
void addMoveLockTime(double seconds)
Add time to a temporary movement lockout.
DtAttributeHandleType< std::string > myLastSensorModeAttr
Handle for previous sensor mode name.
Definition humanControlLogic.h:1477
bool isMoving()
Checks if the entity is currently moving.
bool myInitializedHeading
Flag indicating heading initialization.
Definition humanControlLogic.h:1281
virtual void simulatePitch(double dt)
Simulates pitch movement over time.
virtual void flashlightYawLeft(double val)
Adjusts flashlight yaw leftward.
void zoomOutScope(double val)
Zooms out the weapon scope or optics.
void setWeaponStowed(bool stowed)
Sets the weapon stowed state.
double myMoveLockTimer
Timed move lock time remaining.
Definition humanControlLogic.h:1172
virtual void resetInPlace(float value) override
Resets the entity state without changing position.
bool isAirborne()
Checks if the entity is in the air.
void onBinocularsChanged(bool usingBinoculars)
Handles changes to the binoculars state.
virtual void postureDown(double val)
Transitions to a more prone posture.
bool myForceOrientationUpdate
Flag to force orientation update.
Definition humanControlLogic.h:1287
unsigned int myAppliedCompassUnits
Compass units applied by the role-configured override.
Definition humanControlLogic.h:1038
HumanPosture myDesiredPosture
Desired posture requested by user input.
Definition humanControlLogic.h:1152
DtAttributeHandleType< bool > myHasLaserAttr
Handle indicating whether a laser is available.
Definition humanControlLogic.h:1429
DtAttributeHandleType< bool > myUsingDroneAttr
Handle indicating whether the player is controlling a drone.
Definition humanControlLogic.h:1353
HumanPosture myExpectedPosture
Expected posture after transition completes.
Definition humanControlLogic.h:1146
DtAttributeHandleType< double > myHealthAttr
Handle for health value.
Definition humanControlLogic.h:1401
double myCurrentPitch
Current entity pitch in degrees.
Definition humanControlLogic.h:1251
virtual void yaw(double val, bool mouseInput=false)
Handles yaw (left/right looking) input.
virtual void gazeYaw()
Turns the entity's head to look left/right.
virtual void setPitch(double pitch)
Sets the pitch angle directly.
virtual void toggleWeaponDown(double val)
Toggles weapon down state.
double myLastStrafeValue
Last left/right strafe input value.
Definition humanControlLogic.h:1083
virtual void cycleWeaponState(double val)
Cycles through weapon states (ready, down, stowed)
void onHealthChanged(double health)
Handles changes to the health.
DtAttributeHandleType< double > mySimulatedPitchAttr
Handle for simulated pitch value.
Definition humanControlLogic.h:1449
DtAttributeChangeCallback myCurrentAmmoResourceAttributeCallback
Definition humanControlLogic.h:876
virtual bool thirdPersonAllowed()
Checks if third-person view is allowed.
double mySprintMultiplier
Multiplier for sprint movement speed.
Definition humanControlLogic.h:1053
virtual void reset(float value) override
Forwards a joystick command to controlled drones.
double myTurningRate
Turning rate modifier.
Definition humanControlLogic.h:1266
virtual bool shouldAllowMovement()
Determines if movement should be allowed.
DtAttributeHandleType< Equipment > myCurrentEquipmentAttr
Handle for current equipment selection.
Definition humanControlLogic.h:1421
DtQtQuickOverlay * myActiveScopeOverlay
Currently active scope overlay.
Definition humanControlLogic.h:1337
virtual void parachuteDeploy(double val)
Deploys the parachute.
std::vector< HumanPosture > myPostureSequence
Sequence of postures for cycling.
Definition humanControlLogic.h:1098
virtual void playDiguyAction(const std::string &diguyAction, double duration=0)
Plays a DI-Guy animation action on the entity.
double myRunMultiplier
Multiplier for running movement speed.
Definition humanControlLogic.h:1063
virtual void onCurrentStateChanged(const DtAttributeHandle &stateAttr)
Handles changes to the current state.
void setGazePitch(double pitch)
Sets the gaze pitch attribute.
double myPitchingRate
Pitch rate in degrees per second.
Definition humanControlLogic.h:1261
DtAttributeHandleType< double > myGazePitchAttr
Handle for gaze pitch value.
Definition humanControlLogic.h:1389
double myPostureAnimationWait
Posture animation wait timer.
Definition humanControlLogic.h:1167
virtual void mapPostureToString(const HumanPosture posture, const std::string &postureString)
Maps a posture enum to a string representation.
virtual void percentOfMaxSpeedChangeCallback(double newPercentOfMaxSpeedValue)
Handles changes to the percent of max speed.
DtAttributeHandleType< bool > myUseGazePitchAttr
Handle indicating whether gaze pitch controls are active.
Definition humanControlLogic.h:1381
DtAttributeHandleType< bool > mySprintingAttr
Handle for sprinting state.
Definition humanControlLogic.h:1405
virtual void toggleWeaponStowed(double val)
Toggles weapon stowed state.
virtual void syncCurrentHeadingToOwnship()
Syncs current heading to the entity's latest ownship orientation.
virtual void fire(double val)
Fires the current weapon.
virtual void gazePitch()
Turns the entity's head to look up/down.
void setWeaponState(int state)
Sets the weapon state directly.
bool myTwoStageFire
Flag for two-stage fire mode.
Definition humanControlLogic.h:1298
virtual const char * type() const override
Returns the component type identifier.
makVrv::DtObserver * myObserver
Pointer to the associated observer.
Definition humanControlLogic.h:1029
virtual void setYaw(double yaw)
Sets the yaw angle directly.
DtWeaponResourceLogic * myWeaponResourceLogic
Weapon resource logic component.
Definition humanControlLogic.h:1021
virtual void postureUp(double val)
Transitions to a more upright posture.
double myPitch
Current input-driven pitch offset.
Definition humanControlLogic.h:1276
virtual void standUp(double val)
Transitions to standing posture.
DtAttributeHandleType< bool > myUsingMouseAttr
Handle for mouse-control state.
Definition humanControlLogic.h:1397
virtual void weaponCycleOrDown(bool press)
Cycles through weapons or puts current weapon down.
double myProneAimingImprovementPercent
Aiming improvement percentage in prone position.
Definition humanControlLogic.h:1235
virtual void zoomOutToggleBinoculars(double val)
Zooms out binoculars or toggles binoculars if not active.
virtual void toggleObserverAttachMode(double val)
Toggles the observer attachment mode.
DtAttributeHandleType< bool > myCompassAttr
Handle for compass visibility state.
Definition humanControlLogic.h:1469
virtual void toggleCompass(double val)
Toggles the compass display.
virtual void initPostureStringMaps()
Initializes the posture-to-string mapping tables.
double myUsingBinocularsInputMultiplier
Input sensitivity multiplier when using binoculars.
Definition humanControlLogic.h:1316
virtual void flashlightYawRight(double val)
Adjusts flashlight yaw rightward.
DtAttributeHandle myCurrentResourceHandle
Current ammunition resource attribute name.
Definition humanControlLogic.h:875
DtAttributeHandleType< bool > myFreeLookAttr
Handle for free-look state.
Definition humanControlLogic.h:1373
virtual makVre::DtVreMessageResult handleViewModeMessage(makVre::DtVreMessage *msg)
Handles view mode change messages.
double myPercentOfMaxSpeed
Current percentage of maximum movement speed.
Definition humanControlLogic.h:1211
HumanPosture myLastPosture
Last stable posture.
Definition humanControlLogic.h:1157
double myDelayedToggleWeaponDownTimer
Timer for delayed weapon state changes.
Definition humanControlLogic.h:1188
void onAimingChanged(bool aiming)
Handles changes to the aiming state.
virtual void computeAimingError()
Computes the current aiming error.
virtual void updateLasingState()
Updates the laser designation state.
std::map< HumanPosture, std::string > myPostureToString
Map from posture enum to string representation.
Definition humanControlLogic.h:1088
DtHumanControlLogic()
Default constructor.
DtAttributeHandleType< double > mySimulatedHeadingAttr
Handle for simulated heading value.
Definition humanControlLogic.h:1445
virtual bool initialize(DtPlayerStation *player, DtInitTable &config) override
Initializes the human control logic.
void initWeaponIndex()
Initializes the weapon index.
DtAttributeHandleType< double > myGazeYawAttr
Handle for gaze yaw value.
Definition humanControlLogic.h:1393
int myFirepowerHealth
Current firepower health value.
Definition humanControlLogic.h:1205
void setGazeYaw(double yaw)
Sets the gaze yaw attribute.
DtAttributeHandleType< bool > myMovingBackwardAttr
Handle for moving-backward state.
Definition humanControlLogic.h:1413
double myAimMultiplier
Multiplier for aiming movement speed.
Definition humanControlLogic.h:1073
virtual void aim(double val)
Handles aim input.
std::map< HumanPosture, int > myPostureSequenceIndex
Map from posture to sequence index.
Definition humanControlLogic.h:1103
virtual void setCompassUnits(enum DtCompassUnits units)
Sets the compass units directly.
virtual void addRandomAimingError(DtTaitBryan &aimingOrientation)
Adds a random offset to the input aim orientation.
virtual void postureSelect(double val)
Selects a posture based on the current state.
std::map< HumanPosture, PostureRestrictions > myPostureRestrictions
Map of posture restrictions for each posture.
Definition humanControlLogic.h:1129
virtual void setLaserCode(int val)
Sets the laser designation code.
bool myCachedShowCompass
Cached compass visibility state before menu state.
Definition humanControlLogic.h:1329
DtAttributeHandleType< bool > myNvgAttr
Handle for night-vision state.
Definition humanControlLogic.h:1461
DtAttributeHandleType< bool > myUseGazeYawAttr
Handle indicating whether gaze yaw controls are active.
Definition humanControlLogic.h:1385
virtual void fireLauncher()
Fires the currently equipped launcher.
virtual double getHealthFromAppearance()
Gets the entity's health from appearance bits.
virtual void pitch(double val, bool mouseInput=false)
Handles pitch (up/down looking) input.
double myRequiredAimingErrorPercent
Minimum required aiming error percentage.
Definition humanControlLogic.h:1229
DtAttributeHandleType< makVrv::DtElementID > myLauncherElementIdAttr
Handle for launcher element identifier.
Definition humanControlLogic.h:1365
void showQmlOverlay(const std::string &name)
Shows a QML overlay by name.
DtAttributeHandleType< ObserverAttachMode > myObserverAttachModeAttr
Handle for observer attach mode.
Definition humanControlLogic.h:1457
virtual void weaponDown()
Puts the weapon in down position.
virtual void sendJoystickCommand(const std::string &functionGroup, const std::string &function, double val, bool repeat=false)
Sends a joystick command to the controlled entity.
virtual void setPosture(double val, HumanPosture posture, DtPostureTransition postureTransition)
Sets the entity posture.
void onMovingBackwardChanged(bool movingBackward)
Handles changes to the backward movement state.
double myYawRate
Yaw rate in degrees per second.
Definition humanControlLogic.h:1256
virtual void firepowerHealthChangeCallback(int newFirepowerHealthValue)
Handles changes to the firepower health.
ObserverAttachMode myCachedObserverAttachMode
Cached observer attach mode before menu state.
Definition humanControlLogic.h:1323
double myMaxAimingError
Maximum aiming error in radians.
Definition humanControlLogic.h:1217
DtAttributeHandleType< bool > myClimbingAttr
Handle for climbing state.
Definition humanControlLogic.h:1377
DtAttributeHandleType< int > myWeaponStateAttr
Handle for current weapon state.
Definition humanControlLogic.h:1345
void updateMoveLock()
Updates the move lock state.
virtual void setMouseControlEnabled(bool enabled) override
Sets whether mouse control is enabled.
double myFatigue
Current fatigue level.
Definition humanControlLogic.h:1199
virtual HumanPosture postureFromString(const std::string &posture) const
Converts a posture string to a HumanPosture enum value.
virtual void sprint(double val)
Activates sprint movement.
DtAttributeHandleType< int > myWeaponIndexAttr
Handle for current weapon index.
Definition humanControlLogic.h:1425
DtAttributeHandleType< bool > myCanMoveAttr
Handle for movement enable state.
Definition humanControlLogic.h:1357
bool shouldEnableGaze(bool pitch) const
Determines if gaze should be enabled.
void setMoveLockTime(double seconds)
Set a temporary movement lockout.
double myAimingImprovementPercent
Aiming improvement percentage when aiming.
Definition humanControlLogic.h:1241
virtual ~DtHumanControlLogic() override
Virtual destructor.
virtual void setupExternalLauncher()
Sets up an external launcher.
DtAttributeHandleType< bool > myAimingAttr
Handle for aiming state.
Definition humanControlLogic.h:1349
virtual void tick(double dt) override
Updates control logic for the current frame.
void onCanMoveChanged(bool canMove)
Handles changes to the movement capability.
bool playerCanControl()
Checks if the player can control the entity.
virtual void onLauncherIdChanged(makVrv::DtElementID launcherId)
Handles changes to the launcher element ID.
virtual void fatigueChangeCallback(double newFatigueValue)
Handles changes to the fatigue level.
virtual void toggleNorthReference(double val)
Toggles between true and magnetic north references.
void onWeaponListChanged(const DtAttributeHandle &weaponList)
Handles changes to the weapon list.
DtAttributeHandleType< bool > myFlashlightAttr
Handle for flashlight state.
Definition humanControlLogic.h:1465
virtual void sendJoystickCommand(const DtEntityIdentifier &id, const std::string &functionGroup, const std::string &function, double val, bool repeat=false)
Sends a joystick command to a specific entity.
DtAttributeHandleType< std::vector< std::string > > myWeaponListAttr
Definition humanControlLogic.h:1024
double myCurrentHeading
Current entity heading in degrees.
Definition humanControlLogic.h:1246
void setInitialCompassUnits(enum DtCompassUnits units)
Applies the role-configured compass units without persisting them.
void onEquipmentChanged(Equipment equipment)
Handles changes to the active equipment.
virtual void move(double val)
Handles forward/backward movement input.
double myWalkMultiplier
Multiplier for walking movement speed.
Definition humanControlLogic.h:1068
virtual void manipulateTerrainElement(TerrainElement element, TerrainAction action)
Manipulates a terrain element.
bool handleGazeInput(bool pitch)
Handles gaze input and updates attributes.
void onForwardControlsChanged(bool forwardControls)
Handles changes to the forward controls state.
DtAttributeHandleType< bool > myCanUseWeaponsAttr
Handle for weapon usage enable state.
Definition humanControlLogic.h:1361
virtual void toggleBinoculars(double val)
Toggles binoculars equipment.
virtual void startLasing()
Starts laser designation.
DtAttributeHandleType< bool > myWeaponReadyAttr
Handle for weapon-ready state.
Definition humanControlLogic.h:1417
virtual makVre::DtVreMessageResult handleAppFocusUpdate(makVre::DtVreMessage *msg)
Handles application focus update messages.
virtual void disableFeaturesWhileParachuting()
Disables certain features while parachuting.
virtual void simulateYaw(double dt)
Simulates yaw movement over time.
virtual void goProne(double val)
Transitions to prone posture.
friend class DtHumanVirtualRealityLogic
Friend class declaration to allow VR logic access to protected members.
Definition humanControlLogic.h:146
DtAttributeHandleType< bool > myUsingBinocularsAttr
Handle for binocular usage state.
Definition humanControlLogic.h:1437
virtual void parachuteLeftToggle(double val)
Toggles the left parachute control line.
virtual void throwGrenade()
Throws a grenade.
DtAttributeHandleType< bool > myWalkingAttr
Handle for walking state.
Definition humanControlLogic.h:1409
void onPostureChanged(HumanPosture posture)
Handles changes to the posture.
void setWeaponDown(bool down)
Sets the weapon down state.
double myAimingErrorPercent
Current aiming error as a percentage of maximum.
Definition humanControlLogic.h:1223
void onDiGuyActionChanged(std::string action)
Handles changes to the DI-Guy action.
virtual bool postInitialize() override
Performs post-initialization setup.
Input logic component for the human role.
Definition humanInputLogic.h:27
Virtual reality logic component for the human role.
Definition humanVirtualRealityLogic.h:86
Table-based access to Lua state for configuration data.
Definition initializer.h:38
virtual DtPlayerStation & player()
Gets the player station.
virtual const std::string & name()
Gets the component name.
Class for managing the user interface for engaged roles.
Definition playerStation.h:51
A component that manages Qt Quick overlays for rendering 2D UI elements on top of 3D graphics.
Definition qtQuickOverlay.h:79
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 * joystickSensitivity
Definition humanControlLogic.h:82
constexpr const char * grenadeThrowAnimation
Definition humanControlLogic.h:127
constexpr const char * grenadeLaunchDelay
Definition humanControlLogic.h:124
constexpr const char * weaponLockedWhenMovingPostures
Definition humanControlLogic.h:121
constexpr const char * invertPitchInput
Definition humanControlLogic.h:76
constexpr const char * raiseGunOnAttach
Definition humanControlLogic.h:97
constexpr const char * weaponLockedPostures
Definition humanControlLogic.h:118
constexpr const char * aimingErrorCalcDistanceToTarget
Definition humanControlLogic.h:61
constexpr const char * requiredAimingErrorPercent
Definition humanControlLogic.h:100
constexpr const char * compassUnits
Definition humanControlLogic.h:73
constexpr const char * isAllowedThirdPersonView
Definition humanControlLogic.h:79
constexpr const char * moveLockedPostures
Definition humanControlLogic.h:88
constexpr const char * binocularsInputMultiplier
Definition humanControlLogic.h:70
constexpr const char * moveDelays
Definition humanControlLogic.h:85
constexpr const char * showCompass
Definition humanControlLogic.h:106
constexpr const char * proneAimingImprovementPercent
Definition humanControlLogic.h:94
constexpr const char * aimingImprovementPercent
Definition humanControlLogic.h:67
constexpr const char * sprintMultiplier
Definition humanControlLogic.h:112
constexpr const char * sprintBackwardMultiplier
Definition humanControlLogic.h:109
constexpr const char * walkMultiplier
Definition humanControlLogic.h:115
constexpr const char * aimingErrorCalcMaxSpread
Definition humanControlLogic.h:64
constexpr const char * aimMultiplier
Definition humanControlLogic.h:58
constexpr const char * postureSequence
Definition humanControlLogic.h:91
constexpr const char * runMultiplier
Definition humanControlLogic.h:103
Defines export macros for the Human Frontend library.
#define HUMAN_DLL
Definition export.h:19
Definition humanControlLogic.h:50
!
Definition glsVreMessageUtil.h:50
ObserverAttachMode
Enumeration of camera/observer attachment offsets.
Definition stateDefines.h:44
HumanPosture
Enumeration of human posture states.
Definition stateDefines.h:30
DtVreMessageResult
Enumeration of possible message handling results.
Definition vreMessage.h:33
TerrainAction
Enumeration of actions that can be performed on terrain elements.
Definition stateDefines.h:94
constexpr const char * DtHumanControlLogicType
Type identifier for DtHumanControlLogic component.
Definition humanControlLogic.h:133
Equipment
Enumeration of equipment types that can be held or used.
Definition stateDefines.h:55
TerrainElement
Enumeration of interactive terrain elements.
Definition stateDefines.h:85
Definition appLauncherComponent.h:28
Common enumeration definitions used throughout the VREngage system.
bool weaponLocked
Whether weapon use is locked in this posture.
Definition humanControlLogic.h:1120
bool weaponLockedWhenMoving
Whether weapon use is locked while moving in this posture.
Definition humanControlLogic.h:1123
PostureRestrictions()
Default constructor initializing all restrictions to false.
Definition humanControlLogic.h:1109
bool moveLocked
Whether movement is locked in this posture.
Definition humanControlLogic.h:1117
Defines the base class for all VREngage messages.