18#include <vrvCore/DtUniqueID.h>
20#include <matrix/vlVector.h>
23#include <matrix/vlVector.inl>
24#include <vlpi/entityIdentifier.inl>
25#include <vlpi/entityType.h>
173 virtual void tick(
double dt)
override;
180 virtual const char*
type()
const override;
184 virtual void aim(
double val);
208 virtual void pitch(
double val,
bool mouseInput =
false);
215 virtual void yaw(
double val,
bool mouseInput =
false);
486 const std::string& function,
double val,
bool repeat =
false);
497 const std::string& functionGroup,
const std::string& function,
double val,
bool repeat =
false);
508 virtual void reset(
float value)
override;
Scoped attribute change callback wrapper.
Definition attributeCallback.h:86
Handle class for safe access to attributes.
Definition attributeHandle.h:30
Type-specific handle class for attributes.
Definition attributeHandle.h:181
DtEntityControlLogic()
Constructor.
bool myInvertPitch
Flag for inverting pitch input.
Definition humanControlLogic.h:1017
virtual void fireGun()
Fires the currently equipped gun.
enum DtCompassUnits { DEGREES=0, NATO_MIL } DtCompassUnits
Enumeration of compass unit types.
Definition humanControlLogic.h:150
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:1167
std::map< std::string, HumanPosture > myStringToPosture
Map from string representation to posture enum.
Definition humanControlLogic.h:1062
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:1131
enum DtPostureTransition { POSTURE_UP, POSTURE_DOWN } DtPostureTransition
Enumeration of posture transition directions.
Definition humanControlLogic.h:144
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.
virtual void weaponStow(bool stow)
Stows the current weapon.
float myFatigue
Current fatigue level.
Definition humanControlLogic.h:1173
virtual void flashlightPitchUp(double val)
Adjusts flashlight pitch upward.
DtPostureTransition myLastPostureTransition
Last posture transition direction.
Definition humanControlLogic.h:1110
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.
virtual void walk(double val)
Activates walk movement.
double myLastMoveValue
Last forward/backward movement input value.
Definition humanControlLogic.h:1047
virtual void freeLook(double val)
Toggles free look mode.
bool myMoveLockActive
Move lock active flag.
Definition humanControlLogic.h:1147
bool mySendGazeAngles
Flag for sending gaze angles.
Definition humanControlLogic.h:1266
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.
double myYaw
Current input-driven yaw offset.
Definition humanControlLogic.h:1245
DtAttributeHandleType< std::vector< std::string > > myWeaponList
Definition humanControlLogic.h:1002
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.
int myEventualWeaponState
Target weapon state to transition to.
Definition humanControlLogic.h:1152
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 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.
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:1012
virtual void updateWeaponReady()
Updates the weapon ready state.
double mySprintBackwardMultiplier
Multiplier for backward sprint movement speed.
Definition humanControlLogic.h:1027
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:1105
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:1277
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.
void addMoveLockTime(double seconds)
Add time to a temporary movement lockout.
bool isMoving()
Checks if the entity is currently moving.
bool myInitializedHeading
Flag indicating heading initialization.
Definition humanControlLogic.h:1255
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:1141
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:1261
HumanPosture myDesiredPosture
Desired posture requested by user input.
Definition humanControlLogic.h:1121
HumanPosture myExpectedPosture
Expected posture after transition completes.
Definition humanControlLogic.h:1115
double myCurrentPitch
Current entity pitch in degrees.
Definition humanControlLogic.h:1225
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:1052
virtual void cycleWeaponState(double val)
Cycles through weapon states (ready, down, stowed)
void onHealthChanged(double health)
Handles changes to the health.
DtAttributeChangeCallback myCurrentAmmoResourceAttributeCallback
Definition humanControlLogic.h:859
virtual bool thirdPersonAllowed()
Checks if third-person view is allowed.
double mySprintMultiplier
Multiplier for sprint movement speed.
Definition humanControlLogic.h:1022
virtual void reset(float value) override
Forwards a joystick command to controlled drones.
double myTurningRate
Turning rate modifier.
Definition humanControlLogic.h:1240
virtual bool shouldAllowMovement()
Determines if movement should be allowed.
DtQtQuickOverlay * myActiveScopeOverlay
Currently active scope overlay.
Definition humanControlLogic.h:1305
virtual void parachuteDeploy(double val)
Deploys the parachute.
std::vector< HumanPosture > myPostureSequence
Sequence of postures for cycling.
Definition humanControlLogic.h:1067
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:1032
void setGazePitch(double pitch)
Sets the gaze pitch attribute.
double myPitchingRate
Pitch rate in degrees per second.
Definition humanControlLogic.h:1235
double myPostureAnimationWait
Posture animation wait timer.
Definition humanControlLogic.h:1136
virtual void mapPostureToString(const HumanPosture posture, const std::string &postureString)
Maps a posture enum to a string representation.
DtVector32 walkingVelocity()
Returns the velocity of the player ownship entity.
virtual void toggleWeaponStowed(double val)
Toggles weapon stowed state.
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:1272
virtual const char * type() const override
Returns the component type identifier.
makVrv::DtObserver * myObserver
Pointer to the associated observer.
Definition humanControlLogic.h:1007
virtual void setYaw(double yaw)
Sets the yaw angle directly.
DtWeaponResourceLogic * myWeaponResourceLogic
Weapon resource logic component.
Definition humanControlLogic.h:1000
virtual void onCurrentStateChanged(std::string state)
Handles changes to the current state.
virtual void postureUp(double val)
Transitions to a more upright posture.
double myPitch
Current input-driven pitch offset.
Definition humanControlLogic.h:1250
virtual void standUp(double val)
Transitions to standing posture.
virtual void weaponCycleOrDown(bool press)
Cycles through weapons or puts current weapon down.
double myProneAimingImprovementPercent
Aiming improvement percentage in prone position.
Definition humanControlLogic.h:1209
virtual void zoomOutToggleBinoculars(double val)
Zooms out binoculars or toggles binoculars if not active.
virtual void toggleObserverAttachMode(double val)
Toggles the observer attachment mode.
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:1284
virtual void flashlightYawRight(double val)
Adjusts flashlight yaw rightward.
DtAttributeHandle myCurrentResourceHandle
Current ammunition resource attribute name.
Definition humanControlLogic.h:858
bool myWantThrowGrenade
Flag indicating grenade throw request.
Definition humanControlLogic.h:1157
virtual makVre::DtVreMessageResult handleViewModeMessage(makVre::DtVreMessage *msg)
Handles view mode change messages.
HumanPosture myLastPosture
Last stable posture.
Definition humanControlLogic.h:1126
double myDelayedToggleWeaponDownTimer
Timer for delayed weapon state changes.
Definition humanControlLogic.h:1162
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:1057
DtHumanControlLogic()
Default constructor.
virtual void fatigueChangeCallback(float newFatigueValue)
Handles changes to the fatigue level.
virtual bool initialize(DtPlayerStation *player, DtInitTable &config) override
Initializes the human control logic.
void initWeaponIndex()
Initializes the weapon index.
int myFirepowerHealth
Current firepower health value.
Definition humanControlLogic.h:1179
void setGazeYaw(double yaw)
Sets the gaze yaw attribute.
double myAimMultiplier
Multiplier for aiming movement speed.
Definition humanControlLogic.h:1042
virtual void aim(double val)
Handles aim input.
std::map< HumanPosture, int > myPostureSequenceIndex
Map from posture to sequence index.
Definition humanControlLogic.h:1072
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:1098
virtual void setLaserCode(int val)
Sets the laser designation code.
bool myCachedShowCompass
Cached compass visibility state before menu state.
Definition humanControlLogic.h:1297
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:1203
void showQmlOverlay(const std::string &name)
Shows a QML overlay by name.
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:1230
virtual void firepowerHealthChangeCallback(int newFirepowerHealthValue)
Handles changes to the firepower health.
ObserverAttachMode myCachedObserverAttachMode
Cached observer attach mode before menu state.
Definition humanControlLogic.h:1291
double myMaxAimingError
Maximum aiming error in radians.
Definition humanControlLogic.h:1191
void updateMoveLock()
Updates the move lock state.
virtual void setMouseControlEnabled(bool enabled) override
Sets whether mouse control is enabled.
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.
float myPercentOfMaxSpeed
Current percentage of maximum movement speed.
Definition humanControlLogic.h:1185
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:1215
virtual ~DtHumanControlLogic() override
Virtual destructor.
virtual void setupExternalLauncher()
Sets up an external launcher.
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 toggleNorthReference(double val)
Toggles between true and magnetic north references.
void onWeaponListChanged(const DtAttributeHandle &weaponList)
Handles changes to the weapon list.
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.
double myCurrentHeading
Current entity heading in degrees.
Definition humanControlLogic.h:1220
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:1037
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.
virtual void toggleBinoculars(double val)
Toggles binoculars equipment.
virtual void startLasing()
Starts laser designation.
virtual makVre::DtVreMessageResult handleAppFocusUpdate(makVre::DtVreMessage *msg)
Handles application focus update messages.
virtual void percentOfMaxSpeedChangeCallback(float newPercentOfMaxSpeedValue)
Handles changes to the percent of max speed.
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:141
virtual void parachuteLeftToggle(double val)
Toggles the left parachute control line.
virtual void throwGrenade()
Throws a grenade.
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:1197
void onDiGuyActionChanged(std::string action)
Handles changes to the DI-Guy action.
virtual bool postInitialize() override
Performs post-initialization setup.
Virtual reality logic component for the human role.
Definition humanVirtualRealityLogic.h:83
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:76
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:84
constexpr const char * weaponLockedWhenMovingPostures
Definition humanControlLogic.h:123
constexpr const char * invertPitchInput
Definition humanControlLogic.h:78
constexpr const char * raiseGunOnAttach
Definition humanControlLogic.h:99
constexpr const char * weaponLockedPostures
Definition humanControlLogic.h:120
constexpr const char * aimingErrorCalcDistanceToTarget
Definition humanControlLogic.h:63
constexpr const char * requiredAimingErrorPercent
Definition humanControlLogic.h:102
constexpr const char * compassUnits
Definition humanControlLogic.h:75
constexpr const char * isAllowedThirdPersonView
Definition humanControlLogic.h:81
constexpr const char * moveLockedPostures
Definition humanControlLogic.h:90
constexpr const char * binocularsInputMultiplier
Definition humanControlLogic.h:72
constexpr const char * moveDelays
Definition humanControlLogic.h:87
constexpr const char * showCompass
Definition humanControlLogic.h:108
constexpr const char * proneAimingImprovementPercent
Definition humanControlLogic.h:96
constexpr const char * aimingImprovementPercent
Definition humanControlLogic.h:69
constexpr const char * sprintMultiplier
Definition humanControlLogic.h:114
constexpr const char * sprintBackwardMultiplier
Definition humanControlLogic.h:111
constexpr const char * walkMultiplier
Definition humanControlLogic.h:117
constexpr const char * aimingErrorCalcMaxSpread
Definition humanControlLogic.h:66
constexpr const char * aimMultiplier
Definition humanControlLogic.h:60
constexpr const char * postureSequence
Definition humanControlLogic.h:93
constexpr const char * runMultiplier
Definition humanControlLogic.h:105
Defines export macros for the Human Frontend library.
#define HUMAN_DLL
Definition export.h:19
Definition humanControlLogic.h:52
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
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:129
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:1089
bool weaponLockedWhenMoving
Whether weapon use is locked while moving in this posture.
Definition humanControlLogic.h:1092
PostureRestrictions()
Default constructor initializing all restrictions to false.
Definition humanControlLogic.h:1078
bool moveLocked
Whether movement is locked in this posture.
Definition humanControlLogic.h:1086
Defines the base class for all VREngage messages.