|
VR-Engage
2.3
|
This actuator provides high-fidelity vehicle physics by connecting a VR-Forces entity to a Vortex physics model. It handles vehicle dynamics simulation, terrain interaction, articulated parts, and player control.
Uses Descriptor Type: DtVortexMovementActuatorDescriptor
#include <vortexMovementActuator.h>
Public Types | |
| using | VortexInterfaceMap = std::map<std::string, DtVortexInterface*> |
Public Member Functions | |
| DtVortexMovementActuator (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) | |
| virtual | ~DtVortexMovementActuator () override |
| DtVortexMovementActuator & | operator= (const DtVortexMovementActuator &orig)=delete |
| DtVortexMovementActuator (const DtVortexMovementActuator &orig)=delete | |
| virtual bool | init () override |
| virtual void | tick () override |
| virtual const char * | type () const override |
| virtual bool | createPorts () override |
| virtual bool | createPortGroups () override |
| virtual void | preFirstTickInit () override |
| virtual const std::vector< DtVortexBasePart * > & | getParts () const |
| virtual bool | isInVortexWorld () const |
| virtual bool | isVortexPlayerControlled () const |
| virtual bool | isBeingTowed () const |
| virtual DtUUID | towingTargetUuid () const |
| virtual DtUUID | towingTargetUuid (const VxData::FieldBase &field) const |
| virtual void | dropAboveTerrain (const DtVector &newLocalPosition, double heading) |
| VxMath::Matrix44 | getNextFrameVortexTransform () const |
| VxSim::VxSmartInterface< VxDynamics::Mechanism > | getMechanism () |
| Vx::VxVector3 | getNextFrameVortexPosition () const |
| Vx::VxEulerAngles | getNextFrameVortexOrientation () const |
| void | disableVehicleDynamics () |
| void | enableVehicleDynamics () |
| void | processStartupDynamicsWarmupStep () |
| virtual void | initParametersFromModel () |
| virtual void | updateMassOfChassis () |
Static Public Member Functions | |
| static DtSimComponent * | creator (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) |
Protected Types | |
| enum | MechanismLoadStatus { NOT_LOADED = 0 , LOADING = 1 , LOADED = 2 } |
Protected Member Functions | |
| void | loadMechanism () |
| void | processTerrainChangeNotification (const DtTerrainChangeNotificationInfo &terrainChangeInfo) |
| void | tagDynamicsPartGeometries () |
| virtual void | initArticulatedPartPositions () |
| virtual void | initTrackPartPositions (bool didInitLeftSprocket, bool didInitRightSprocket) |
| virtual const char * | trackNameForPart (const DtVortexDynamicsPart &dynamicsPart) const |
| virtual VxData::FieldBase * | vehicleParameter (const std::string ¶meterName) const |
| virtual bool | initFieldFromArticulatedPartPosition (VxData::FieldBase *field, const makVrf::DtArticulatedPartStateRepository *partRepository, const DtVortexDynamicsPart *dynamicsPart) const |
| virtual bool | initTrackWheelRelativeToSprocket (VxData::FieldBase *trackWheel, VxData::FieldBase *sprocket, const makVrf::DtArticulatedPartStateRepository *partRepository, const DtVortexDynamicsPart *dynamicsPart) const |
| virtual bool | initWheelPositionFromArticulatedPart (DtVortexDynamicsPart *dynamicsPart, const makVrf::DtArticulatedPartStateRepository *partRepository) |
| virtual bool | initSprocketPositionFromArticulatedPart (DtVortexDynamicsPart *dynamicsPart, const makVrf::DtArticulatedPartStateRepository *partRepository) |
| virtual void | initTrackWheelPositionFromArticulatedPart (DtVortexDynamicsPart *dynamicsPart, const makVrf::DtArticulatedPartStateRepository *partRepository, const char *trackName) |
| virtual void | initTrackIdlerDistanceFromArticulatedPart (DtVortexDynamicsPart *dynamicsPart, const makVrf::DtArticulatedPartStateRepository *partRepository, const char *trackName) |
| DtVortexBasePart * | findPart (int partId) const |
| virtual bool | isVortexMechanismValid () const |
| virtual void | getLowestBoundingPointsOfMechanism (std::vector< DtVector > &outputPoints) |
| virtual void | processSetVortexWhileUntasked (DtSimMessage *msg) |
| virtual bool | createPSR () |
| virtual bool | isHighFidelityCGF () const |
| virtual bool | isPlayerControlledAs (std::string role) const |
| virtual void | realizeVortexState () |
| virtual bool | isTerrainAvailable () const |
| virtual void | detectTerrainFallthrough () |
| virtual void | setVortexMechanismLocation (const Vx::VxVector3 &nwuLocation, double heading) |
| Vx::VxVector3 | getVortexLocation (const DtVector &inputCoords) const |
| virtual void | sendVehicleDynamicsUpdate (bool enable) |
| virtual void | sendExtensionUpdate (VxSim::VxExtension *extension, bool enable) |
| void | connectTowingTargetObserver () |
| void | processTowingTargetChanged (const VxData::FieldBase &field) |
| void | updateTowingHookGroupState (const DtUUID ¤tTowingTargetUuid) |
| void | resetTowingHookGroup () |
| void | sendTowingHookGroupUpdate (bool enable) |
| VxSim::VxExtension * | findTowingHookGroupExtension () |
| virtual void | checkTaskStatus (bool vortexActive) |
| virtual bool | taskConflictsWithVortex (const DtSimTaskMessageType &taskType) const |
| virtual void | connectTowingTargetDeletedSignal (const DtUUID &targetUuid) |
| virtual void | processTowingTargetDeleted () |
| virtual void | clearTowingTargetTracking () |
| virtual void | sendVehiclePartsUpdate (Vx::VxPart::EntityControlTypeEnum control) |
| virtual void | addSetCallbacks () |
| virtual void | removeSetCallbacks () |
| virtual void | handleSetLocation (const DtVector &location) |
| virtual void | handleSetHeading (DtReal heading) |
| virtual void | resetWheelParts () |
| virtual void | manageWheelPartStateTransitions (bool inVortexWorld) |
| virtual void | updateState () |
| virtual void | restoreWheels () |
| virtual void | engageParkingBrakeOnDisengage (bool isDriver) |
| virtual void | updateFuel () |
| virtual void | updateDestroyedState () |
| virtual double | fuelLeft () const |
| virtual void | useFuel (double fuelUsed) |
| DtVortexBasePart * | createPart (makVre::DtVortexSimArtPartDescriptor *desc) |
| virtual void | createVortexPartsFromDescriptor () |
| virtual void | setThresholdsFromDescriptor () |
| virtual void | updateGroundInteractionPoint (const DtDcm &localOrientation, const DtVector &localPosition, const DtAttachedTerrain &terrain, bool &dataAvailable) const |
| virtual void | createVortexConfigurationsFromDescriptor () |
| virtual void | createVortexInterfacesFromDescriptor () |
| virtual void | connectInterfacesToPorts () |
| virtual void | queueMechanismLoad () |
| virtual void | updatePorts () |
| virtual void | populateArtPartMapProperty () |
| VxSim::VxSmartInterface< VxDynamics::Part > | findPartFromPathRecursive (const VxSim::VxWeakInterface< VxSim::IObject > &objectToLookThroughWeak, const std::vector< std::string > &pathToLookForPart, int index) |
| virtual bool | checkDistanceFromCoordinateOriginOverLimit (const DtVector &position, double distance) |
Static Protected Member Functions | |
| static void | terrainChangeNotification (const DtTerrainChangeNotificationInfo &terrainChangeInfo, void *usr) |
| static void | setVortexWhileUntaskedCallback (DtSimMessage *msg, void *usrData) |
| static void | setHeadingCallback (DtReal heading, void *usrData) |
| static void | setLocationCallback (const DtVector &location, void *usrData) |
Friends | |
| class | DtVxSimulationFileManagerFacadeListener |
| using DtVortexMovementActuator::VortexInterfaceMap = std::map<std::string, DtVortexInterface*> |
Type definition for a map of Vortex interfaces by name.
|
protected |
| DtVortexMovementActuator::DtVortexMovementActuator | ( | const DtString & | name, |
| DtLocalObject * | owner, | ||
| DtSimulationServices * | simManager, | ||
| DtComponentDescriptor * | desc = 0, | ||
| DtReaderWriterRegistry * | parentRegistry = 0 ) |
Constructor.
Initializes the actuator with the specified parameters.
| name | Component name |
| owner | Owner local object |
| simManager | Simulation services |
| desc | Component descriptor |
| parentRegistry | Parent reader/writer registry |
Referenced by DtVortexMovementActuator(), and operator=().
|
overridevirtual |
Destructor.
|
delete |
References DtVortexMovementActuator().
|
delete |
Assignment operator and copy constructor not implemented.
References DtVortexMovementActuator().
|
overridevirtual |
Initializes the actuator.
Registers set callbacks and queues the loading of the physics mechanism.
|
overridevirtual |
Updates the actuator each simulation frame.
Manages the state of the Vortex mechanism, updates input/output ports, and synchronizes between VR-Forces and Vortex.
|
overridevirtual |
Gets the type of this actuator.
|
overridevirtual |
Creates the ports required for actuator operation.
Creates the ports from the VHL Interface.
|
overridevirtual |
Creates the port groups for the actuator.
Creates the input and output port groups from the VHL Interface.
|
static |
Factory method for creating instances of this actuator.
| name | Component name |
| owner | Owner local object |
| simManager | Simulation services |
| desc | Component descriptor |
| parentRegistry | Parent reader/writer registry |
|
overridevirtual |
Initializes the actuator before the first simulation tick.
Calls initializeMovementChooserName() and dropAboveTerrain() to initially place the vehicle on the terrain. Also passes any specified Vortex parameters from the system definition file.
|
virtual |
Gets the list of all Vortex parts in this actuator.
|
virtual |
Checks if high-fidelity Vortex physics should be active.
Vortex should be active if the player is driving the vehicle OR if the vehicle is stationary and high-fidelity collision physics are enabled for this vehicle.
|
virtual |
Checks if the entity is player controlled.
|
virtual |
Checks if the entity is being towed by another Vortex entity.
|
virtual |
Gets the entity currently attached to this vehicle's tow hook.
|
virtual |
Converts a Vortex field value to a tow target UUID.
| field | Vortex field containing the hook target value |
|
virtual |
Drops the vehicle above the terrain at a specified position.
Calculates the terrain height at the new location and positions the vehicle at the appropriate height above the terrain. The additional height above terrain is determined by the descriptor's additionalDropHeight() value (default: 0.5 meters).
This method checks all bounding points of the vehicle mechanism to ensure no part of the vehicle is placed below the terrain surface. The vehicle is positioned such that its lowest point is at the terrain height plus the additional drop height.
| newLocalPosition | Where to drop the vehicle (in local coordinates) |
| heading | The heading to set the vehicle at (in radians) |
| VxMath::Matrix44 DtVortexMovementActuator::getNextFrameVortexTransform | ( | ) | const |
Gets the next frame's location and orientation as a VxMatrix.
| VxSim::VxSmartInterface< VxDynamics::Mechanism > DtVortexMovementActuator::getMechanism | ( | ) |
Gets the current mechanism associated with the actuator.
| Vx::VxVector3 DtVortexMovementActuator::getNextFrameVortexPosition | ( | ) | const |
Gets the next frame Vortex location from the entity.
| Vx::VxEulerAngles DtVortexMovementActuator::getNextFrameVortexOrientation | ( | ) | const |
Gets the next frame Vortex orientation from the entity.
| void DtVortexMovementActuator::disableVehicleDynamics | ( | ) |
Disables the vehicle dynamics.
Sets the parts to static and disables vehicle dynamics.
| void DtVortexMovementActuator::enableVehicleDynamics | ( | ) |
Enables the vehicle dynamics.
Sets the parts to dynamic and enables vehicle dynamics.
| void DtVortexMovementActuator::processStartupDynamicsWarmupStep | ( | ) |
Applies the deferred startup dynamics disable after one physics step.
Called from DtMechAddon::preStep() so the mechanism receives one warm-up step after initial placement before dynamics are disabled.
|
virtual |
Initializes Vortex model parameters with data from VR-Forces.
Initializes vehicle mass and wheel articulated part positions from VR-Forces entity parameters. Called by loadMechanism.
|
virtual |
Updates the chassis mass from entity parameters.
Finds the chassis part (part ID -1) in the Vortex mechanism and updates its mass and inertia tensor based on the entity's mass parameter. The center of mass offset is preserved during the inertia recomputation.
|
protected |
Loads the Vortex mechanism.
Performs the main loading of the mechanism. Called by the Listener in Vortex at a safe time.
|
staticprotected |
Static callback for terrain change notifications.
| terrainChangeInfo | Information about the terrain change |
| usr | Pointer to this actuator |
|
protected |
Processes terrain change notifications.
Checks if the entity is within the spatial extents of the terrain change notification and sets the terrain change flag if needed.
| terrainChangeInfo | Information about the terrain change |
|
protected |
Tags the geometries of all dynamics parts for collision detection.
|
protectedvirtual |
Initializes Vortex vehicle-part positions from VR-Forces articulated parts.
Initializes conventional wheels and sprockets before processing track wheels and idlers, which depend on their corresponding sprocket positions.
|
protectedvirtual |
Initializes tracked-vehicle wheel and idler positions.
| didInitLeftSprocket | True when the left sprocket position was initialized |
| didInitRightSprocket | True when the right sprocket position was initialized |
|
protectedvirtual |
Gets the Vortex track parameter name for a dynamics part.
|
protectedvirtual |
Gets a named Vortex vehicle parameter.
Logs a warning if the parameter is unavailable.
|
protectedvirtual |
Initializes a Vortex position field from an articulated-part position.
|
protectedvirtual |
Initializes a track-wheel position relative to its sprocket.
|
protectedvirtual |
Initializes a conventional wheel position from an articulated part.
|
protectedvirtual |
Initializes a sprocket position from an articulated part.
|
protectedvirtual |
Initializes a track-wheel position from an articulated part.
|
protectedvirtual |
Initializes a track idler's distance from its sprocket.
|
staticprotected |
Callback for scripted set data request message.
Calls processUseHiFiCollisionsInStationaryCgfState() to process the message.
| msg | The message to process |
| usrData | User data |
|
protected |
Gets the Vortex part associated with an articulated part ID.
| partId | The part ID of the Vortex part to look for |
|
protectedvirtual |
Checks if the Vortex mechanism is valid.
Valid means the following conditions are all true:
|
protectedvirtual |
Gets the lowest bounding points of the current mechanism.
The values are returned in NWU (Vortex Coordinate System).
| outputPoints | Vector to store the lowest bounding points in current world space |
|
protectedvirtual |
Processes a set data request to enable/disable high-fidelity physics.
Sets the value for useHiFiCollisionInStationaryCgfState in the process state repository from the incoming scripted set data request message.
| msg | The message to process |
|
protectedvirtual |
Creates a process state repository for this component.
Creates a DtVortexMovementPSR for holding state associated with this component, specifically the useHiFiCollisionInStationaryCgfState flag.
|
protectedvirtual |
Checks whether Vortex While Untasked is enabled.
Returns the actuator's configured Vortex While Untasked state without inspecting the entity's current task state.
|
protectedvirtual |
Checks if the entity is player controlled in a specific role.
Note that there may be multiple roles associated with a vehicle, so responsibilities for controlling the vehicle may be split across multiple role players, and/or shared with CGF control.
| role | The role to check (e.g., "Driver") |
|
protectedvirtual |
Updates the Vortex state based on current conditions.
Adds or removes the Vortex mechanism from the Vortex scene and registers or unregisters this entity as a Vortex entity in the Collision Proxy Generator, as appropriate for the current Vortex Active state.
|
protectedvirtual |
Checks if terrain is available below the vehicle.
|
protectedvirtual |
Detects and logs terrain fall-through conditions.
Checks if the vehicle has fallen through the terrain when terrain data is not available. Logs diagnostic information to help identify terrain loading issues. Called when terrain is unavailable during Vortex simulation.
|
protectedvirtual |
Sets the Vortex mechanism's location and orientation.
Sets the Vortex mechanism's transform using the location and heading and resets wheel parts to be attached to the mechanism.
| nwuLocation | The location in NWU coordinates |
| heading | The heading in radians |
|
protected |
Converts local coordinates to Vortex coordinates.
| inputCoords | The coordinates in local database coordinates |
|
protectedvirtual |
Sends a vehicle dynamics update event.
Internal function that sends the vehicle dynamics update event to Vortex.
| enable | True to enable dynamics, false to disable |
|
protectedvirtual |
Sends a Vortex extension update event.
| extension | The extension to update |
| enable | True to enable the extension, false to disable it |
|
protected |
Connects to tow-hook target updates from the driver interface.
|
protected |
Processes tow-hook target field changes.
| field | Vortex field that changed |
|
protected |
Updates tow-hook group reset state based on the current hook target.
| currentTowingTargetUuid | Current hook target UUID |
|
protected |
Resets the Vortex tow-hook group extension.
|
protected |
Enables or disables the Vortex tow-hook group extension.
Used to mirror the vehicle-extension in/out-of-world activation path so towing behavior is inactive whenever this actuator is out of the Vortex world.
| enable | True to enable the hook group, false to disable it |
|
protected |
Finds this mechanism's tow-hook group extension.
|
protectedvirtual |
Cancels CGF tasks that conflict with Vortex control.
When Vortex is active and the entity is tasked, cancels each top-level task for which taskConflictsWithVortex() returns true, so a CGF controller does not compete with Vortex for vehicle or turret control. Other tasks continue to run. Clears the independently tasked state only when no top-level tasks remain.
| vortexActive | True when Vortex control is active; false leaves task state unchanged |
|
protectedvirtual |
Determines whether a task type conflicts with Vortex control.
Reads the task categories from the scripted-task action categories and the entity's task execution rule groups. A task conflicts when it is in the Movement category, or when it is in the Weapon category and the Vortex mechanism has a turret interface.
| taskType | The task type to classify |
|
protectedvirtual |
Connects to the current tow target deletion signal.
| targetUuid | The current tow target UUID |
|
protectedvirtual |
Processes removal of the currently tracked tow target.
|
protectedvirtual |
Clears current tow target tracking.
|
protectedvirtual |
Updates the control state of all vehicle parts.
Sets the control type of all parts to disable or enable collisions and simulation.
| control | The control type (Static or Dynamic) |
|
protectedvirtual |
Adds set callbacks for location and heading.
|
protectedvirtual |
Removes set callbacks for location and heading.
|
staticprotected |
Callback for heading changes.
| heading | The new heading |
| usrData | User data |
|
staticprotected |
Callback for location changes.
| location | The new location |
| usrData | User data |
|
protectedvirtual |
Handles a location change request.
| location | The new location |
|
protectedvirtual |
Handles a heading change request.
| heading | The new heading |
|
protectedvirtual |
Resets wheel parts to their default positions.
Resets all wheel parts to zero position on the network.
|
protectedvirtual |
Manages wheel part state transitions when entering or exiting Vortex world.
Handles the logic for resetting or restoring wheel parts based on whether the vehicle is in the Vortex physics simulation. When exiting Vortex, resets wheel parts to prevent network updates that interfere with VRV automatic wheel control. When entering Vortex, restores the original wheel part collection.
| inVortexWorld | True if the vehicle is currently in the Vortex physics world |
|
protectedvirtual |
Updates state properties.
|
protectedvirtual |
Restores wheel articulated parts.
Restores wheels in the articulated part collection.
|
protectedvirtual |
Automatically engages parking brake when disengaging from driver role.
Automatically engages the parking brake when a player disengages from the driver role if the brake is not already engaged. Simulates a two-tick button press (down then up) to activate the brake.
| isDriver | True if currently controlled as driver, false otherwise |
|
protectedvirtual |
Updates fuel level.
|
protectedvirtual |
|
protectedvirtual |
Gets the current fuel level.
|
protectedvirtual |
Consumes fuel.
| fuelUsed | The amount of fuel to consume |
|
protected |
Creates a Vortex part from a descriptor.
| desc | The part descriptor |
|
protectedvirtual |
Creates all Vortex parts defined in the descriptor.
|
protectedvirtual |
Sets precision thresholds based on the descriptor.
|
protectedvirtual |
Updates the ground interaction point under the vehicle.
This is used by the DtGroundVehicleTrailingEffectController to determine the soil type under the vehicle.
| localOrientation | Orientation relative to terrain or parent entity |
| localPosition | Position relative to terrain or parent entity |
| terrain | The attached terrain (database or parent entity) |
| dataAvailable | Set to true if terrain data is available |
|
protectedvirtual |
Creates Vortex configurations from the descriptor.
Creates a Vortex Configuration from the configuration section of the descriptor.
|
protectedvirtual |
Creates Vortex interfaces defined in the descriptor.
Also creates input/output ports and port groups.
|
protectedvirtual |
Connects interfaces to ports.
Connects all the values defined in VHL interfaces to Vortex.
|
protectedvirtual |
Queues the mechanism for loading.
Queues the mechanism to load in a thread-safe manner.
|
protectedvirtual |
Updates ports with data from Vortex interfaces.
|
protectedvirtual |
|
protected |
Recursively finds a part from a path.
| objectToLookThroughWeak | Object to search for the part |
| pathToLookForPart | Path defined in the system definition file |
| index | Current index in the path |
|
protectedvirtual |
Checks if the incoming position is further than distance.
| position | incoming position. Pass position in geocentric (DIS) |
| distance | distance |
|
friend |
References DtVxSimulationFileManagerFacadeListener.
Referenced by DtVxSimulationFileManagerFacadeListener.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Controls whether Vortex physics simulation continues for destroyed entities.
When true, allows Vortex physics to remain active even when the entity is destroyed or mobility-killed. When false (default), Vortex control is disabled for destroyed or mobility-killed entities.
This flag is initialized from the descriptor's allowVortexWhileDestroyed setting during the actuator initialization phase.
|
protected |
Controls whether terrain fallthrough detection is enabled.
When true, the actuator monitors for terrain availability issues during Vortex simulation and logs diagnostic information when fallthrough conditions are detected. When false (default), fallthrough detection is disabled.
This flag is initialized from the descriptor's detectTerrainFallthrough setting during the actuator initialization phase.
|
protected |
|
protected |
|
protected |