|
VR-Engage
2.3
|
DtGunnerControlLogic provides input handling and simulation logic for gunner roles, including weapon control, turret movement, firing, aiming modes, and commander override capabilities. It manages weapon selection, zoom levels, and sensor types.
#include <gunnerControlLogic.h>
Public Member Functions | |
| DtGunnerControlLogic () | |
| virtual | ~DtGunnerControlLogic () override |
| virtual bool | initialize (DtPlayerStation *player, DtInitTable &config) override |
| virtual bool | postInitialize () override |
| virtual void | tick (double dt) override |
| virtual void | shutdown () override |
| virtual const char * | type () const override |
| virtual void | fire (double val) |
| virtual void | azimuth (double val) |
| virtual void | elevation (double val) |
| virtual void | stabilize (double val) |
| virtual void | nextWeapon (double val) |
| virtual void | previousWeapon (double val) |
| virtual void | zoomIn (double val) |
| virtual void | zoomOut (double val) |
| virtual void | nextSensor (double val) |
| virtual void | cycleAimingMode () |
| virtual void | switchToAltRole () |
| virtual void | handleSwitchToAltRole (float val) |
| virtual void | turretUp (float val) |
| virtual void | turretDown (float val) |
| virtual void | turretRight (float val) |
| virtual void | turretLeft (float val) |
| virtual void | zoom (float val) |
| virtual void | missileX (double val) |
| virtual void | missileY (double val) |
| virtual void | toggleArmed () |
| virtual makVre::DtVreMessageResult | handleMenuMessage (makVre::DtVreMessage *msg) |
Public Member Functions inherited from makVre::DtEntityControlLogic | |
| DtEntityControlLogic () | |
| virtual | ~DtEntityControlLogic () override |
| virtual void | setMouseControlEnabled (bool enabled) |
| virtual bool | isMouseControlEnabled () |
| virtual bool | isMouseControlSupportAllowed () const |
| virtual void | setMouseControlSupportAllowed (bool enable) |
| virtual const std::vector< std::string > & | joystickGroups () const |
| virtual void | sendJoystickCommand (const DtEntityIdentifier &id, const std::string &functionGroup, const std::string &function, double val, bool repeat=false) |
| virtual makVre::DtVreMessageResult | handleSimState (makVre::DtVreMessage *msg) |
| virtual makVre::DtVreMessageResult | handleReset (makVre::DtVreMessage *message) |
| virtual makVre::DtVreMessageResult | handleCreationStatus (makVre::DtVreMessage *message) |
| virtual void | reset (float val) |
| virtual void | resetInPlace (float val) |
| virtual void | toggleMouseControl (float val) |
| virtual void | enableMouseControl (float val) |
| virtual makVre::DtVreMessageResult | handleFocusMessage (makVre::DtVreMessage *message) |
Public Member Functions inherited from makVre::DtPlayerComponent | |
| DtPlayerComponent () | |
| virtual | ~DtPlayerComponent () |
| bool | componentReady () const |
| void | setComponentReady (bool ready) |
| virtual DtInitTickStatus | finalizeInitTick (double dt) |
| virtual void | setName (const std::string &name) |
| virtual const std::string & | name () |
| virtual DtPlayerStation & | player () |
| virtual DtAttributeHandle & | playerAttributeStore () |
| virtual const DtAttributeHandle & | playerAttributeStore () const |
| virtual const DtAttributeHandle & | ownshipState () const |
| virtual void | setExtendedData (const std::string &key, const std::string &value, DtEntityIdentifier entity=DtEntityIdentifier::nullId()) |
Protected Member Functions | |
| virtual bool | aimWithObserver () const |
| virtual void | setCommanderOverrideActive (bool active) const |
| void | sendJoystickMessage (const std::string &func, const double val) |
| virtual void | aimMissile (double x, double y) |
| virtual bool | canFire () |
| virtual void | sendMissileTargetUpdate (const DtEntityIdentifier &missileId, const std::string &missileMarking, const DtVector &targetPos) |
Protected Member Functions inherited from makVre::DtEntityControlLogic | |
| bool | requiresControl () const |
| bool | isAirborne () const |
| void | showNotification (const QString &text, double duration) |
| virtual void | takeControlOfPlayerEntity () |
| virtual void | releaseControlOfPlayerEntity () |
Protected Member Functions inherited from makVre::DtPlayerComponent | |
| virtual void | initializeStateAttributes () |
| makVre::DtGunnerControlLogic::DtGunnerControlLogic | ( | ) |
Constructor for DtGunnerControlLogic.
Initializes component state and checks out required VRE_GROUND license
|
overridevirtual |
Destructor for DtGunnerControlLogic.
|
overridevirtual |
Initializes the gunner control logic component.
| player | Pointer to the player station this component belongs to |
| config | Configuration table containing gunner settings |
Sets up joystick controls, input handlers, state attributes, zoom levels, and extended weapon systems
Reimplemented from makVre::DtEntityControlLogic.
References makVre::DtPlayerComponent::player().
|
overridevirtual |
Performs post-initialization after all components are initialized.
Locates and establishes connection with the DtWeaponResourceLogic component
Reimplemented from makVre::DtEntityControlLogic.
|
overridevirtual |
Called every frame to update gunner control logic.
| dt | Delta time since the last frame in seconds |
Updates weapon system state, handles extended weapon system targeting, and sends firing position updates
Reimplemented from makVre::DtEntityControlLogic.
|
overridevirtual |
Shuts down the gunner control logic component.
Cleans up input handlers, message handlers, and disables commander override if active
Reimplemented from makVre::DtEntityControlLogic.
|
overridevirtual |
Returns the component type identifier.
Reimplemented from makVre::DtEntityControlLogic.
|
virtual |
Input functions mapped to particular action strings in configuration.
Handles weapon firing input
| val | Input value (1.0 = fire, 0.0 = stop firing) |
|
virtual |
Controls turret azimuth (horizontal rotation)
| val | Input value for azimuth rate (-1.0 to 1.0) |
|
virtual |
Controls turret elevation (vertical angle)
| val | Input value for elevation rate (-1.0 to 1.0) |
|
virtual |
Controls weapon stabilization system.
| val | Input value (1.0 = enable, 0.0 = disable) |
|
virtual |
Selects the next available weapon.
| val | Input value (1.0 = select next weapon) |
|
virtual |
Selects the previous available weapon.
| val | Input value (1.0 = select previous weapon) |
|
virtual |
Increases the sight magnification level.
| val | Input value (1.0 = zoom in one level) |
|
virtual |
Decreases the sight magnification level.
| val | Input value (1.0 = zoom out one level) |
|
virtual |
Cycles to the next available sensor type (visual, NVG, thermal)
| val | Input value (1.0 = select next sensor) |
|
virtual |
Cycles between available aiming modes.
|
virtual |
Switches between gunner and alternate role (e.g., commander RWS)
|
virtual |
Handles input for switching to alternate role.
| val | Input value (1.0 = switch role) |
|
virtual |
Moves turret upward (direct control)
| val | Input value (0.0 to 1.0 for speed) |
|
virtual |
Moves turret downward (direct control)
| val | Input value (0.0 to 1.0 for speed) |
|
virtual |
Moves turret to the right (direct control)
| val | Input value (0.0 to 1.0 for speed) |
|
virtual |
Moves turret to the left (direct control)
| val | Input value (0.0 to 1.0 for speed) |
|
virtual |
Controls continuous zoom level directly.
| val | Input value (-1.0 to 1.0) for zoom direction and speed |
|
virtual |
Set x and y inputs for manual missile aiming.
|
virtual |
|
virtual |
Toggles armed state for a weapon that requires arming (weapons don't by default).
|
virtual |
Handles action menu messages for the gunner role.
| msg | The message to handle |
Processes menu actions like cycling weapons, sensors, aiming modes, and role switching
|
protectedvirtual |
Determines if aiming should use the observer's view.
|
protectedvirtual |
Sets the commander override active state.
| active | True to activate commander override, false to deactivate |
|
protected |
Sends a joystick message to the entity.
| func | Function name to trigger on the entity |
| val | Value to send with the function (typically -1.0 to 1.0) |
|
protectedvirtual |
Update missile's target point based on the x and y input. Called any time x and y are not 0.
|
protectedvirtual |
Returns true if the weapon can fire. Checks for range, azimuth and isArmed.
|
protectedvirtual |
|
protected |
Previously used munition name, used to detect changes.
|
protected |
Primary control group name for this gunner station.
|
protected |
Input logic that handles mapping of input actions to functions.
|
protected |
Name of the weapon system controlled by this gunner.
|
protected |
Pointer to the weapon resource logic component.
|
protected |
Available zoom magnification levels.
|
protected |
Current index into the zoom levels array.
|
protected |
Configuration table for extended weapon systems.
|
protected |
Configuration for the currently active extended weapon system.
|
protected |
Current target location for extended weapon systems.
|
protected |
Element ID of the current target.
|
protected |
Name of the alternate role to switch to.
|
protected |
Flag indicating if this gunner is in override mode.
|
protected |
Name of the system to override.
|
protected |
Flag indicating if a weapon cycle operation is in progress.
|
protected |
Timer for delaying weapon cycling operations.
|
protected |
Allow the configuration to specify a resource name directly.
|
protected |
Distance (meters) to project a fallback aim point along the observer's boresight when the center-screen intersection finds no terrain or entity. 0.0 disables projection. Set via the projectedTargetDistance config parameter.
|
protected |
True when the current extended-weapon-system target came from projecting a fallback aim point (no real terrain/entity intersection was found). The shared "range" attribute (from DtGunnerRangeSimLogic, which uses its own intersection) is not meaningful in this case, so canFire() must not gate on it.
|
protected |
| Attribute Store Key | resources |
|---|
|
protected |
| Attribute Store Key | munitionInfo |
|---|
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Attribute handle storing the currently selected munition type for this weapon system.
The attribute key is system-prefixed: <systemName>.current-munition.
| Attribute Store Key | <systemName>.current-munition |
|---|
|
protected |
Attribute handle storing the active sensor view index (0=Visual, 1=NVG, 2=Thermal-white, 3=Thermal-black).
| Attribute Store Key | currentSensor |
|---|
|
protected |
Attribute handle indicating whether the weapon is currently firing.
| Attribute Store Key | firing |
|---|
|
protected |
Attribute handle indicating whether the weapon system is in the armed state.
The attribute key is configurable via the armedProperty config parameter.
| Attribute Store Key | <armedProperty> |
|---|
|
protected |
Attribute handle storing the current main-gun azimuth angle in radians.
The attribute key is configurable via the azimuthStateAttribute config parameter. Defaults to "mainGunAzimuth" if not specified.
| Attribute Store Key | mainGunAzimuth |
|---|
|
protected |
Attribute handle indicating whether a valid weapon intersection pose has been computed.
| Attribute Store Key | weaponPoseValid |
|---|
|
protected |
Attribute handle storing the weapon muzzle location in geocentric coordinates.
| Attribute Store Key | weaponLocation |
|---|
|
protected |
Attribute handle indicating whether an intersection point is required before firing.
| Attribute Store Key | fireRequiresIntersection |
|---|
|
protected |
Attribute handle storing the current zoom magnification level.
| Attribute Store Key | zoom |
|---|
|
protected |
Attribute handle indicating whether the zoom level has changed and interpolation needs updating.
| Attribute Store Key | zoomChanged |
|---|
|
protected |
Attribute handle storing the geocentric location of the extended weapon target.
| Attribute Store Key | extendedWeaponTargetLocation |
|---|
|
protected |
Attribute handle storing the scene element ID of the extended weapon target entity.
| Attribute Store Key | extendedWeaponTargetElement |
|---|
|
protected |
Attribute handle storing the display name of the extended weapon target entity.
| Attribute Store Key | extendedWeaponTargetElementName |
|---|
|
protected |
Attribute handle indicating whether the missile launcher has a locked target entity.
| Attribute Store Key | launcherHasTargetEntity |
|---|
|
protected |
Attribute handle indicating whether a guided missile is currently in flight.
| Attribute Store Key | missileInFlight |
|---|
|
protected |
Attribute handle indicating whether the player has manual control of a missile in flight.
| Attribute Store Key | manualMissileControl |
|---|
|
protected |
Attribute handle storing the observer's geocentric position for targeting calculations.
| Attribute Store Key | observerLocation |
|---|
|
protected |
Attribute handle storing the target impact point for missile guidance.
| Attribute Store Key | missileTargetLocation |
|---|
|
protected |
Attribute handle indicating whether the player is currently occupying the gunner's seat.
| Attribute Store Key | isInGunnerSeat |
|---|
|
protected |
Attribute handle storing the list of available sensor mode name strings.
| Attribute Store Key | sensorModes |
|---|
|
protected |
Attribute handle indicating whether indirect-fire coordinate targeting mode is active.
| Attribute Store Key | usingIndirectCoordinate |
|---|
|
protected |
Attribute handle storing the geocentric coordinate used for indirect fire targeting.
| Attribute Store Key | indirectFireCoordinate |
|---|
|
protected |
Attribute handle indicating whether the launcher supports selectable target modes.
| Attribute Store Key | hasLauncherTargetModes |
|---|
|
protected |
Attribute handle storing the name of the currently selected launcher target mode.
| Attribute Store Key | launcherTargetMode |
|---|
|
protected |
Attribute handle indicating whether the weapon system is in a fully armed and ready state.
| Attribute Store Key | isArmed |
|---|
|
protected |
Attribute handle storing the entity identifier of the vehicle the gunner is attached to.
| Attribute Store Key | attachedTo |
|---|
|
protected |
Attribute handle storing the calculated range to the current aim point.
| Attribute Store Key | range |
|---|
|
protected |
Attribute handle storing the weapon's current orientation in Tait-Bryan angles.
| Attribute Store Key | weaponOrientation |
|---|
|
protected |
Attribute handle storing the observer's current orientation in Tait-Bryan angles.
| Attribute Store Key | observerOrientation |
|---|
|
protected |
Attribute handle storing the name of the currently selected munition.
| Attribute Store Key | current-munition |
|---|