VR-Engage  2.2
Loading...
Searching...
No Matches
vortexMovementActuator.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2024 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file vortexMovementActuator.h
7//! \brief Movement actuator that integrates Vortex physics for vehicle dynamics
8//! \ingroup vreVrfVortex
9
10#pragma once
11
12#include <vreVrfVortex/export.h>
13
14#include <vrfobjcore/actuatorComponent.h>
15#include <vrfobjcore/platformLocalObjectFacade.h>
16
17#include <string>
18
19#include <Vx/VxTransform.h>
20#include <Vx/VxPart.h>
21#include <VxSim/VxSmartInterface.h>
22#include <VxSim/VxVHLInterface.h>
23#include <VxSim/IDynamics.h>
24#include <VxSim/VxSimulationFileManagerFacade.h>
25#include <VxDynamics/Mechanism.h>
26
28
29#include <terrainInterface/terrainImplementation.h>
30
31#include <readerWriter/symbolString.h>
32#include <vrfobjcore/localObject.h>
33#include <vlpi/articulatedPartCollection.h>
34
35// forward defs
37class DtUpdateRepositoryOutputPortGroup;
41
42class DtInputPortGroup;
43class DtOutputPortGroup;
44class DtAnalogInputPort;
45class DtBooleanInputPort;
46class DtSingleConnectionInputPort;
47class DtSingleConnectionOutputPort;
48class DtGroundVehicleStateRepository;
49
50class DtStringOutputPort;
51class DtMechAddon;
53
54namespace VxSim
55{
56class VxExtension;
57class VxPluginExtension;
58class VxVHLInterface;
59class VxSimulationState;
60} // namespace VxSim
61
62namespace makVre
63{
70} // namespace makVre
71
72//! \brief Type identifier for the Vortex movement actuator
73const char DtVortexMovementActuatorType[] = "vortex-movement-actuator";
74
75//! \brief Actuator component that integrates Vortex physics for vehicle dynamics
76//!
77//! This actuator provides high-fidelity vehicle physics by connecting a VR-Forces
78//! entity to a Vortex physics model. It handles vehicle dynamics simulation,
79//! terrain interaction, articulated parts, and player control.
80//!
81//! Uses Descriptor Type: DtVortexMovementActuatorDescriptor
82class VREVRFVORTEX_DLL DtVortexMovementActuator : public DtActuatorComponent
83{
84public:
85 //! \brief Type definition for a map of Vortex interfaces by name
86 using VortexInterfaceMap = std::map<std::string, DtVortexInterface*>;
87
88public:
89 //! \brief Constructor
90 //!
91 //! Initializes the actuator with the specified parameters.
92 //!
93 //! \param name Component name
94 //! \param owner Owner local object
95 //! \param simManager Simulation services
96 //! \param desc Component descriptor
97 //! \param parentRegistry Parent reader/writer registry
98 DtVortexMovementActuator(const DtString& name, DtLocalObject* owner, DtSimulationServices* simManager,
99 DtComponentDescriptor* desc = 0, DtReaderWriterRegistry* parentRegistry = 0);
100
101 //! \brief Destructor
102 virtual ~DtVortexMovementActuator() override;
103
104 //! \brief Assignment operator and copy constructor not implemented
107
108 //! \brief Initializes the actuator
109 //!
110 //! Registers set callbacks and queues the loading of the physics mechanism.
111 //!
112 //! \return True on success, false otherwise
113 virtual bool init() override;
114
115 //! \brief Updates the actuator each simulation frame
116 //!
117 //! Manages the state of the Vortex mechanism, updates input/output ports,
118 //! and synchronizes between VR-Forces and Vortex.
119 virtual void tick() override;
120
121 //! \brief Gets the type of this actuator
122 //!
123 //! \return DtVortexMovementActuatorType
124 virtual const char* type() const override;
125
126 //! \brief Creates the ports required for actuator operation
127 //!
128 //! Creates the ports from the VHL Interface.
129 //!
130 //! \return True on success, false otherwise
131 virtual bool createPorts() override;
132
133 //! \brief Creates the port groups for the actuator
134 //!
135 //! Creates the input and output port groups from the VHL Interface.
136 //!
137 //! \return True on success, false otherwise
138 virtual bool createPortGroups() override;
139
140 //! \brief Factory method for creating instances of this actuator
141 //!
142 //! \param name Component name
143 //! \param owner Owner local object
144 //! \param simManager Simulation services
145 //! \param desc Component descriptor
146 //! \param parentRegistry Parent reader/writer registry
147 //! \return New instance of this class
148 static DtSimComponent* creator(const DtString& name, DtLocalObject* owner, DtSimulationServices* simManager,
149 DtComponentDescriptor* desc = 0, DtReaderWriterRegistry* parentRegistry = 0);
150
151 //! \brief Initializes the actuator before the first simulation tick
152 //!
153 //! Calls initializeMovementChooserName() and dropAboveTerrain() to initially place
154 //! the vehicle on the terrain. Also passes any specified Vortex parameters from the
155 //! system definition file.
156 virtual void preFirstTickInit() override;
157
158 //! \brief Gets the list of all Vortex parts in this actuator
159 //!
160 //! \return Vector of pointers to Vortex parts
161 virtual const std::vector<DtVortexBasePart*>& getParts() const;
162
163 //! \brief Checks if high-fidelity Vortex physics should be active
164 //!
165 //! Vortex should be active if the player is driving the vehicle OR if the vehicle
166 //! is stationary and high-fidelity collision physics are enabled for this vehicle.
167 //!
168 //! \return True if Vortex physics should be active, false otherwise
169 virtual bool isInVortexWorld() const;
170
171 //! \brief Checks if the entity is player controlled
172 //!
173 //! \return True if the entity is player controlled, false otherwise
174 virtual bool isVortexPlayerControlled() const;
175
176 //! \brief Checks if the entity is being towed by another Vortex entity
177 //!
178 //! \return True if the entity is being towed, false otherwise
179 virtual bool isBeingTowed() const;
180
181 //! \brief Drops the vehicle above the terrain at a specified position
182 //!
183 //! Calculates the terrain height at the new location and positions the vehicle
184 //! at the appropriate height above the terrain. The additional height above terrain
185 //! is determined by the descriptor's additionalDropHeight() value (default: 0.5 meters).
186 //!
187 //! This method checks all bounding points of the vehicle mechanism to ensure no part
188 //! of the vehicle is placed below the terrain surface. The vehicle is positioned such
189 //! that its lowest point is at the terrain height plus the additional drop height.
190 //!
191 //! \param newLocalPosition Where to drop the vehicle (in local coordinates)
192 //! \param heading The heading to set the vehicle at (in radians)
193 //!
194 //! \note The additional height value is now configured via DtVortexMovementActuatorDescriptor::setAdditionalDropHeight()
195 //! \see DtVortexMovementActuatorDescriptor::additionalDropHeight()
196 virtual void dropAboveTerrain(
197 const DtVector& newLocalPosition, double heading);
198
199 //! \brief Gets the next frame's location and orientation as a VxMatrix
200 //!
201 //! \return Matrix containing orientation and position in NWU coordinates
202 VxMath::Matrix44 getNextFrameVortexTransform() const;
203
204 //! \brief Gets the current mechanism associated with the actuator
205 //!
206 //! \return Smart interface to the current mechanism
207 VxSim::VxSmartInterface<VxDynamics::Mechanism> getMechanism();
208
209 //! \brief Gets the next frame Vortex location from the entity
210 //!
211 //! \return Location vector in Vortex coordinates
212 Vx::VxVector3 getNextFrameVortexPosition() const;
213
214 //! \brief Gets the next frame Vortex orientation from the entity
215 //!
216 //! \return Euler angles in Vortex coordinates
217 Vx::VxEulerAngles getNextFrameVortexOrientation() const;
218
219 //! \brief Disables the vehicle dynamics
220 //!
221 //! Sets the parts to static and disables vehicle dynamics.
223
224 //! \brief Enables the vehicle dynamics
225 //!
226 //! Sets the parts to dynamic and enables vehicle dynamics.
228
229protected:
231
232 //! \brief Updates Vortex model parameters with data from VR-Forces
233 //!
234 //! Updates vehicle mass and wheel articulated part positions from VR-Forces entity parameters.
235 //! Called by loadMechanism.
237
238 //! \brief Loads the Vortex mechanism
239 //!
240 //! Performs the main loading of the mechanism. Called by the Listener in Vortex
241 //! at a safe time.
243
244 //! \brief Static callback for terrain change notifications
245 //!
246 //! \param terrainChangeInfo Information about the terrain change
247 //! \param usr Pointer to this actuator
248 static void terrainChangeNotification(const DtTerrainChangeNotificationInfo& terrainChangeInfo, void* usr);
249
250 //! \brief Processes terrain change notifications
251 //!
252 //! Checks if the entity is within the spatial extents of the terrain change
253 //! notification and sets the terrain change flag if needed.
254 //!
255 //! \param terrainChangeInfo Information about the terrain change
256 void processTerrainChangeNotification(const DtTerrainChangeNotificationInfo& terrainChangeInfo);
257
258protected:
259 //! \brief Callback for scripted set data request message
260 //!
261 //! Calls processUseHiFiCollisionsInStationaryCgfState() to process the message.
262 //!
263 //! \param msg The message to process
264 //! \param usrData User data
265 static void setVortexWhileUntaskedCallback(DtSimMessage* msg, void* usrData);
266
267 //! \brief Gets the Vortex part associated with an articulated part ID
268 //!
269 //! \param partId The part ID of the Vortex part to look for
270 //! \return Pointer to the base part, or nullptr if not found
271 DtVortexBasePart* findPart(int partId) const;
272
273 //! \brief Checks if the Vortex mechanism is valid
274 //!
275 //! Valid means the following conditions are all true:
276 //! - myMechanism.getExtension() != nullptr
277 //! - myMechanism.getInterface() != nullptr
278 //! - myMechanism.getObject() != nullptr
279 //! - myMechanism.valid()
280 //!
281 //! \return True if the mechanism is valid, false otherwise
282 virtual bool isVortexMechanismValid() const;
283
284 //! \brief Gets the lowest bounding points of the current mechanism
285 //!
286 //! The values are returned in NWU (Vortex Coordinate System).
287 //!
288 //! \param outputPoints Vector to store the lowest bounding points in current world space
289 virtual void getLowestBoundingPointsOfMechanism(std::vector<DtVector>& outputPoints);
290
291 //! \brief Processes a set data request to enable/disable high-fidelity physics
292 //!
293 //! Sets the value for useHiFiCollisionInStationaryCgfState in the process state repository
294 //! from the incoming scripted set data request message.
295 //!
296 //! \param msg The message to process
297 virtual void processSetVortexWhileUntasked(DtSimMessage* msg);
298
299 //! \brief Creates a process state repository for this component
300 //!
301 //! Creates a DtVortexMovementPSR for holding state associated with this component,
302 //! specifically the useHiFiCollisionInStationaryCgfState flag.
303 //!
304 //! \return True on success, false otherwise
305 virtual bool createPSR();
306
307 //! \brief Checks if the entity is currently a high-fidelity CGF
308 //!
309 //! Returns true if entity is currently executing a high-fidelity Vortex model,
310 //! false otherwise. Checks if the movement-chooser controller is actively tasked.
311 //!
312 //! \return True if high-fidelity, false otherwise
313 virtual bool isHighFidelityCGF() const;
314
315 //! \brief Checks if the entity is player controlled in a specific role
316 //!
317 //! Note that there may be multiple roles associated with a vehicle, so
318 //! responsibilities for controlling the vehicle may be split across multiple role players,
319 //! and/or shared with CGF control.
320 //!
321 //! \param role The role to check (e.g., "Driver")
322 //! \return True if player controlled in the specified role, false otherwise
323 virtual bool isPlayerControlledAs(std::string role) const;
324
325 //! \brief Updates the Vortex state based on current conditions
326 //!
327 //! Adds or removes the Vortex mechanism from the Vortex scene and registers or unregisters
328 //! this entity as a Vortex entity in the Collision Proxy Generator, as appropriate for the
329 //! current Vortex Active state.
330 virtual void realizeVortexState();
331
332 //! \brief Checks if terrain is available below the vehicle
333 //!
334 //! \return True if terrain is available below the center of the vehicle, false otherwise
335 virtual bool isTerrainAvailable() const;
336
337 //! \brief Detects and logs terrain fall-through conditions
338 //!
339 //! Checks if the vehicle has fallen through the terrain when terrain data is not available.
340 //! Logs diagnostic information to help identify terrain loading issues.
341 //! Called when terrain is unavailable during Vortex simulation.
343
344 //! \brief Sets the Vortex mechanism's location and orientation
345 //!
346 //! Sets the Vortex mechanism's transform using the location and heading and
347 //! resets wheel parts to be attached to the mechanism.
348 //!
349 //! \param nwuLocation The location in NWU coordinates
350 //! \param heading The heading in radians
351 virtual void setVortexMechanismLocation(const Vx::VxVector3& nwuLocation, double heading);
352
353 //! \brief Converts local coordinates to Vortex coordinates
354 //!
355 //! \param inputCoords The coordinates in local database coordinates
356 //! \return The corresponding coordinates in NWU (Vortex) coordinates
357 Vx::VxVector3 getVortexLocation(const DtVector& inputCoords) const;
358
359 //! \brief Sends a vehicle dynamics update event
360 //!
361 //! Internal function that sends the vehicle dynamics update event to Vortex.
362 //!
363 //! \param enable True to enable dynamics, false to disable
364 virtual void sendVehicleDynamicsUpdate(bool enable);
365
366 //! \brief Updates the control state of all vehicle parts
367 //!
368 //! Sets the control type of all parts to disable or enable collisions and simulation.
369 //!
370 //! \param control The control type (Static or Dynamic)
371 virtual void sendVehiclePartsUpdate(Vx::VxPart::EntityControlTypeEnum control);
372
373 //! \brief Adds set callbacks for location and heading
374 virtual void addSetCallbacks();
375
376 //! \brief Removes set callbacks for location and heading
377 virtual void removeSetCallbacks();
378
379 //! \brief Callback for heading changes
380 //!
381 //! \param heading The new heading
382 //! \param usrData User data
383 static void setHeadingCallback(DtReal heading, void* usrData);
384
385 //! \brief Callback for location changes
386 //!
387 //! \param location The new location
388 //! \param usrData User data
389 static void setLocationCallback(const DtVector& location, void* usrData);
390
391 //! \brief Handles a location change request
392 //!
393 //! \param location The new location
394 virtual void handleSetLocation(const DtVector& location);
395
396 //! \brief Handles a heading change request
397 //!
398 //! \param heading The new heading
399 virtual void handleSetHeading(DtReal heading);
400
401 //! \brief Resets wheel parts to their default positions
402 //!
403 //! Resets all wheel parts to zero position on the network.
404 virtual void resetWheelParts();
405
406 //! \brief Manages wheel part state transitions when entering or exiting Vortex world
407 //!
408 //! Handles the logic for resetting or restoring wheel parts based on whether the vehicle
409 //! is in the Vortex physics simulation. When exiting Vortex, resets wheel parts to prevent
410 //! network updates that interfere with VRV automatic wheel control. When entering Vortex,
411 //! restores the original wheel part collection.
412 //!
413 //! \param inVortexWorld True if the vehicle is currently in the Vortex physics world
414 virtual void manageWheelPartStateTransitions(bool inVortexWorld);
415
416 //! \brief Updates state properties
417 virtual void updateState();
418
419 //! \brief Restores wheel articulated parts
420 //!
421 //! Restores wheels in the articulated part collection.
422 virtual void restoreWheels();
423
424 //! \brief Automatically engages parking brake when disengaging from driver role
425 //!
426 //! Automatically engages the parking brake when a player disengages from the driver
427 //! role if the brake is not already engaged. Simulates a two-tick button press
428 //! (down then up) to activate the brake.
429 //!
430 //! \param isDriver True if currently controlled as driver, false otherwise
431 virtual void engageParkingBrakeOnDisengage(bool isDriver);
432
433 //! \brief Updates fuel level
434 virtual void updateFuel();
435
436 virtual void updateDestroyedState();
437
438 //! \brief Gets the current fuel level
439 //!
440 //! \return The amount of fuel left
441 virtual double fuelLeft() const;
442
443 //! \brief Consumes fuel
444 //!
445 //! \param fuelUsed The amount of fuel to consume
446 virtual void useFuel(double fuelUsed);
447
448 //! \brief Creates a Vortex part from a descriptor
449 //!
450 //! \param desc The part descriptor
451 //! \return Pointer to the created part
453
454 //! \brief Creates all Vortex parts defined in the descriptor
456
457 //! \brief Sets precision thresholds based on the descriptor
459
460 //! \brief Updates the ground interaction point under the vehicle
461 //!
462 //! This is used by the DtGroundVehicleTrailingEffectController to determine
463 //! the soil type under the vehicle.
464 //!
465 //! \param localOrientation Orientation relative to terrain or parent entity
466 //! \param localPosition Position relative to terrain or parent entity
467 //! \param terrain The attached terrain (database or parent entity)
468 //! \param dataAvailable Set to true if terrain data is available
470 const DtDcm& localOrientation, const DtVector& localPosition,
471 const DtAttachedTerrain& terrain, bool& dataAvailable) const;
472
473 //! \brief Creates Vortex configurations from the descriptor
474 //!
475 //! Creates a Vortex Configuration from the configuration section of the descriptor.
477
478 //! \brief Creates Vortex interfaces defined in the descriptor
479 //!
480 //! Also creates input/output ports and port groups.
482
483 //! \brief Connects interfaces to ports
484 //!
485 //! Connects all the values defined in VHL interfaces to Vortex.
487
488 //! \brief Queues the mechanism for loading
489 //!
490 //! Queues the mechanism to load in a thread-safe manner.
492
493 //! \brief Updates ports with data from Vortex interfaces
494 virtual void updatePorts();
495
496 //! \brief Recursively finds a part from a path
497 //!
498 //! \param objectToLookThroughWeak Object to search for the part
499 //! \param pathToLookForPart Path defined in the system definition file
500 //! \param index Current index in the path
501 //! \return Smart pointer to the part, or null if not found
502 VxSim::VxSmartInterface<VxDynamics::Part> findPartFromPathRecursive(
503 const VxSim::VxWeakInterface<VxSim::IObject>& objectToLookThroughWeak, const std::vector<std::string>& pathToLookForPart,
504 int index);
505
506 //! \brief Checks if the incoming position is further than distance
507 //! \param position incoming position. Pass position in geocentric (DIS)
508 //! \param distance distance
509 //! \return True if enuPosition is further than distance
510 virtual bool checkDistanceFromCoordinateOriginOverLimit(const DtVector& position, double distance);
511
512protected:
513 // Descriptors and state repos
515 DtGroundVehicleStateRepository* myGroundVehicleState;
517 DtPlatformLocalObjectFacade myPlatformLocalObjectFacade;
518 DtArticulatedPartCollection myCollectionWithWheels;
519
520 // Vortex
521 VxSim::VxSmartInterface<VxDynamics::Mechanism> myMechanism;
522 VxSim::VxSmartInterface<DtMechAddon> myMechAddon;
523 VxSim::VxExtension* myVehicleExt;
524 std::vector<DtVortexBasePart*> myParts;
526 std::shared_ptr<VxSim::VxSimulationFileManagerFacade> mySimulationFileManagerFacade;
527 Vx::VxSmartPtr<DtVxSimulationFileManagerFacadeListener> myListener;
528
529 // Configuration
530 std::shared_ptr<makVre::DtVortexConfiguration> myConfiguration;
531
532 // Ports and Port Groups
533 DtUpdateRepositoryOutputPortGroup* myUpdateRepositoryOutputPortGroup;
534 DtStringOutputPort* myAimingModePort;
535
537
542
545
546 // For mechanism loading
555
557
568
569 //! \brief Controls whether Vortex physics simulation continues for destroyed entities
570 //!
571 //! When true, allows Vortex physics to remain active even when the entity is
572 //! destroyed or mobility-killed. When false (default), Vortex control is disabled
573 //! for destroyed or mobility-killed entities.
574 //!
575 //! This flag is initialized from the descriptor's allowVortexWhileDestroyed setting
576 //! during the actuator initialization phase.
577 //!
578 //! \note Default value is false.
579 //! \see DtVortexMovementActuatorDescriptor::allowVortexWhileDestroyed()
581
582 //! \brief Controls whether terrain fallthrough detection is enabled
583 //!
584 //! When true, the actuator monitors for terrain availability issues during Vortex
585 //! simulation and logs diagnostic information when fallthrough conditions are detected.
586 //! When false (default), fallthrough detection is disabled.
587 //!
588 //! This flag is initialized from the descriptor's detectTerrainFallthrough setting
589 //! during the actuator initialization phase.
590 //!
591 //! \note Default value is false.
592 //! \see DtVortexMovementActuatorDescriptor::detectTerrainFallthrough()
594
598
600};
601
602//! \brief Listener for Vortex file loading events
603//!
604//! Handles callbacks for file loading operations and notifies the
605//! movement actuator when loading is complete.
606class DtVxSimulationFileManagerFacadeListener : public VxSim::VxSimulationFileManagerFacade::Listener
607{
608public:
609 //! \brief Constructor
610 //!
611 //! \param actuator Pointer to the movement actuator
613
614 //! \brief Destructor
616
617 //! \brief Called when a requested object has been loaded
618 //!
619 //! \param requestId Unique ID of the request
620 //! \param name Name of the loaded object
621 //! \param result Result of the loading operation
622 virtual void onRequestedObjectLoaded(const VxSim::VxUuid& requestId, const std::string& name, RequestResult result) override;
623
624protected:
625 DtVortexMovementActuator* myMovementActuator; //!< The movement actuator
626};
627
628//! \brief Addon extension for Vortex mechanisms
629//!
630//! Provides additional functionality for Vortex mechanisms,
631//! including pre-step callbacks for synchronizing with VR-Forces.
632class DtMechAddon : public VxSim::IExtension, public VxSim::IDynamics, public VxDynamics::IMechanismAddOn
633{
634public:
635 //! \brief Factory key for creating instances of this addon
636 static const VxSim::VxFactoryKey kFactoryKey;
637
638public:
639 //! \brief Constructor
640 //!
641 //! \param proxy Pointer to the extension proxy
642 explicit DtMechAddon(VxSim::VxExtension* proxy);
643
644 //! \brief Destructor
645 virtual ~DtMechAddon() override;
646
647 //! \brief Called before each physics step
648 //!
649 //! Updates the Vortex mechanism from VR-Forces data.
650 virtual void preStep() override;
651
652 //! \brief Sets the movement actuator to communicate with
653 //!
654 //! \param obj Pointer to the movement actuator
656
657 //! \brief Sets whether updates come from CGF
658 //!
659 //! \param cgfDriven True if driven by CGF, false if player-controlled
660 void setUpdatingFromCGF(bool cgfDriven);
661
662protected:
663 DtVortexMovementActuator* myMovementActuator; //!< The movement actuator
664 bool myUpdatingFromCGF; //!< Flag indicating if updates come from CGF
665};
Addon extension for Vortex mechanisms.
Definition vortexMovementActuator.h:633
void setUpdatingFromCGF(bool cgfDriven)
Sets whether updates come from CGF.
DtMechAddon(VxSim::VxExtension *proxy)
Constructor.
static const VxSim::VxFactoryKey kFactoryKey
Factory key for creating instances of this addon.
Definition vortexMovementActuator.h:636
void setVortexMovementActuator(DtVortexMovementActuator *obj)
Sets the movement actuator to communicate with.
virtual ~DtMechAddon() override
Destructor.
DtVortexMovementActuator * myMovementActuator
The movement actuator.
Definition vortexMovementActuator.h:663
bool myUpdatingFromCGF
Flag indicating if updates come from CGF.
Definition vortexMovementActuator.h:664
virtual void preStep() override
Called before each physics step.
Base class for Vortex parts in the physics simulation.
Definition vortexPart.h:82
Class for managing Vortex interfaces.
Definition vortexInterface.h:188
Descriptor for Vortex physics-based movement simulation.
Definition vortexMovementActuatorDescriptor.h:34
Actuator component that integrates Vortex physics for vehicle dynamics.
Definition vortexMovementActuator.h:83
bool myAutoParkButtonDown
Definition vortexMovementActuator.h:539
virtual void processSetVortexWhileUntasked(DtSimMessage *msg)
Processes a set data request to enable/disable high-fidelity physics.
bool myWasInVortexWorldLastTick
Definition vortexMovementActuator.h:536
virtual double fuelLeft() const
Gets the current fuel level.
double myPartAngularVelocityThreshold
Definition vortexMovementActuator.h:566
void disableVehicleDynamics()
Disables the vehicle dynamics.
VxMath::Matrix44 getNextFrameVortexTransform() const
Gets the next frame's location and orientation as a VxMatrix.
static void setHeadingCallback(DtReal heading, void *usrData)
Callback for heading changes.
DtPlatformLocalObjectFacade myPlatformLocalObjectFacade
Definition vortexMovementActuator.h:517
virtual void addSetCallbacks()
Adds set callbacks for location and heading.
virtual bool createPortGroups() override
Creates the port groups for the actuator.
VxSim::VxSmartInterface< DtMechAddon > myMechAddon
Definition vortexMovementActuator.h:522
Vx::VxEulerAngles getNextFrameVortexOrientation() const
Gets the next frame Vortex orientation from the entity.
makVre::DtVortexPhysicalWorld * myVortexPhysicalWorld
Definition vortexMovementActuator.h:556
static void setLocationCallback(const DtVector &location, void *usrData)
Callback for location changes.
DtStringOutputPort * myAimingModePort
Definition vortexMovementActuator.h:534
std::shared_ptr< makVre::DtVortexConfiguration > myConfiguration
Definition vortexMovementActuator.h:530
static DtSimComponent * creator(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
Factory method for creating instances of this actuator.
MechanismLoadStatus myMechanismLoadStatus
Definition vortexMovementActuator.h:553
virtual void manageWheelPartStateTransitions(bool inVortexWorld)
Manages wheel part state transitions when entering or exiting Vortex world.
virtual void sendVehicleDynamicsUpdate(bool enable)
Sends a vehicle dynamics update event.
DtTaitBryan myPreviousOrientation
Definition vortexMovementActuator.h:596
double myPartPositionThreshold
Definition vortexMovementActuator.h:563
DtVortexStateRepository * myVehicleRepository
Definition vortexMovementActuator.h:516
virtual void handleSetHeading(DtReal heading)
Handles a heading change request.
virtual const std::vector< DtVortexBasePart * > & getParts() const
Gets the list of all Vortex parts in this actuator.
DtVortexMovementActuator & operator=(const DtVortexMovementActuator &orig)=delete
Assignment operator and copy constructor not implemented.
bool myHaveVortexTurretInterface
Definition vortexMovementActuator.h:541
virtual void updateState()
Updates state properties.
virtual bool init() override
Initializes the actuator.
VxSim::VxUuid myLoadObjectRequestId
Definition vortexMovementActuator.h:554
VxSim::VxSmartInterface< VxDynamics::Mechanism > myMechanism
Definition vortexMovementActuator.h:521
VxSim::VxSmartInterface< VxDynamics::Mechanism > getMechanism()
Gets the current mechanism associated with the actuator.
virtual bool isVortexMechanismValid() const
Checks if the Vortex mechanism is valid.
virtual void handleSetLocation(const DtVector &location)
Handles a location change request.
virtual bool createPorts() override
Creates the ports required for actuator operation.
DtUpdateRepositoryOutputPortGroup * myUpdateRepositoryOutputPortGroup
Definition vortexMovementActuator.h:533
virtual void useFuel(double fuelUsed)
Consumes fuel.
void queueMechanismLoad()
Queues the mechanism for loading.
DtGroundVehicleStateRepository * myGroundVehicleState
Definition vortexMovementActuator.h:515
VortexInterfaceMap myInterfaces
Definition vortexMovementActuator.h:525
void updateParametersFromModel()
Updates Vortex model parameters with data from VR-Forces.
double myAngularVelocityThreshold
Definition vortexMovementActuator.h:561
bool myDetectTerrainFallthrough
Controls whether terrain fallthrough detection is enabled.
Definition vortexMovementActuator.h:593
friend class DtVxSimulationFileManagerFacadeListener
Definition vortexMovementActuator.h:230
virtual void realizeVortexState()
Updates the Vortex state based on current conditions.
virtual bool isTerrainAvailable() const
Checks if terrain is available below the vehicle.
void updateGroundInteractionPoint(const DtDcm &localOrientation, const DtVector &localPosition, const DtAttachedTerrain &terrain, bool &dataAvailable) const
Updates the ground interaction point under the vehicle.
void processTerrainChangeNotification(const DtTerrainChangeNotificationInfo &terrainChangeInfo)
Processes terrain change notifications.
void createVortexConfigurationsFromDescriptor()
Creates Vortex configurations from the descriptor.
DtVortexMovementActuator(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
Constructor.
void connectInterfacesToPorts()
Connects interfaces to ports.
static void setVortexWhileUntaskedCallback(DtSimMessage *msg, void *usrData)
Callback for scripted set data request message.
virtual void getLowestBoundingPointsOfMechanism(std::vector< DtVector > &outputPoints)
Gets the lowest bounding points of the current mechanism.
double myPartLinearVelocityThreshold
Definition vortexMovementActuator.h:565
std::shared_ptr< VxSim::VxSimulationFileManagerFacade > mySimulationFileManagerFacade
Definition vortexMovementActuator.h:526
virtual bool isBeingTowed() const
Checks if the entity is being towed by another Vortex entity.
bool mySpawnedFromSpawnPoint
Definition vortexMovementActuator.h:544
makVre::DtVortexMovementPSR * myProcessState
Definition vortexMovementActuator.h:599
virtual bool isHighFidelityCGF() const
Checks if the entity is currently a high-fidelity CGF.
virtual void restoreWheels()
Restores wheel articulated parts.
virtual void tick() override
Updates the actuator each simulation frame.
virtual void updateFuel()
Updates fuel level.
Vx::VxVector3 getNextFrameVortexPosition() const
Gets the next frame Vortex location from the entity.
virtual void updateDestroyedState()
virtual bool isPlayerControlledAs(std::string role) const
Checks if the entity is player controlled in a specific role.
virtual bool isVortexPlayerControlled() const
Checks if the entity is player controlled.
void createVortexInterfacesFromDescriptor()
Creates Vortex interfaces defined in the descriptor.
DtVortexMovementActuator(const DtVortexMovementActuator &orig)=delete
double myPositionThreshold
Definition vortexMovementActuator.h:558
DtSymbolString myMovementChooserControllerName
Definition vortexMovementActuator.h:597
virtual bool checkDistanceFromCoordinateOriginOverLimit(const DtVector &position, double distance)
Checks if the incoming position is further than distance.
virtual void sendVehiclePartsUpdate(Vx::VxPart::EntityControlTypeEnum control)
Updates the control state of all vehicle parts.
DtVector myPreviousPosition
Definition vortexMovementActuator.h:595
virtual void dropAboveTerrain(const DtVector &newLocalPosition, double heading)
Drops the vehicle above the terrain at a specified position.
std::map< std::string, DtVortexInterface * > VortexInterfaceMap
Type definition for a map of Vortex interfaces by name.
Definition vortexMovementActuator.h:86
virtual void engageParkingBrakeOnDisengage(bool isDriver)
Automatically engages parking brake when disengaging from driver role.
MechanismLoadStatus
Definition vortexMovementActuator.h:548
@ LOADED
Definition vortexMovementActuator.h:551
@ LOADING
Definition vortexMovementActuator.h:550
@ NOT_LOADED
Definition vortexMovementActuator.h:549
void createVortexPartsFromDescriptor()
Creates all Vortex parts defined in the descriptor.
const DtVortexMovementActuatorDescriptor * myDescriptor
Definition vortexMovementActuator.h:514
virtual void resetWheelParts()
Resets wheel parts to their default positions.
void enableVehicleDynamics()
Enables the vehicle dynamics.
double myVelocityThreshold
Definition vortexMovementActuator.h:560
double myPartOrientationThreshold
Definition vortexMovementActuator.h:564
DtVortexBasePart * createPart(makVre::DtVortexSimArtPartDescriptor *desc)
Creates a Vortex part from a descriptor.
virtual void preFirstTickInit() override
Initializes the actuator before the first simulation tick.
virtual bool createPSR()
Creates a process state repository for this component.
static void terrainChangeNotification(const DtTerrainChangeNotificationInfo &terrainChangeInfo, void *usr)
Static callback for terrain change notifications.
virtual const char * type() const override
Gets the type of this actuator.
virtual void detectTerrainFallthrough()
Detects and logs terrain fall-through conditions.
virtual void updatePorts()
Updates ports with data from Vortex interfaces.
bool myAllowVortexWhileDestroyed
Controls whether Vortex physics simulation continues for destroyed entities.
Definition vortexMovementActuator.h:580
double myDropTimer
Definition vortexMovementActuator.h:567
bool myIsVortexDynamicsActive
Definition vortexMovementActuator.h:543
void setThresholdsFromDescriptor()
Sets precision thresholds based on the descriptor.
double myOrientationThreshold
Definition vortexMovementActuator.h:559
Vx::VxVector3 getVortexLocation(const DtVector &inputCoords) const
Converts local coordinates to Vortex coordinates.
Vx::VxSmartPtr< DtVxSimulationFileManagerFacadeListener > myListener
Definition vortexMovementActuator.h:527
virtual bool isInVortexWorld() const
Checks if high-fidelity Vortex physics should be active.
DtArticulatedPartCollection myCollectionWithWheels
Definition vortexMovementActuator.h:518
bool myNeedsWheelPartRemoval
Definition vortexMovementActuator.h:540
virtual void setVortexMechanismLocation(const Vx::VxVector3 &nwuLocation, double heading)
Sets the Vortex mechanism's location and orientation.
bool myWasDriverLastTick
Definition vortexMovementActuator.h:538
void loadMechanism()
Loads the Vortex mechanism.
virtual ~DtVortexMovementActuator() override
Destructor.
virtual void removeSetCallbacks()
Removes set callbacks for location and heading.
VxSim::VxSmartInterface< VxDynamics::Part > findPartFromPathRecursive(const VxSim::VxWeakInterface< VxSim::IObject > &objectToLookThroughWeak, const std::vector< std::string > &pathToLookForPart, int index)
Recursively finds a part from a path.
std::vector< DtVortexBasePart * > myParts
Definition vortexMovementActuator.h:524
double myAccelerationThreshold
Definition vortexMovementActuator.h:562
VxSim::VxExtension * myVehicleExt
Definition vortexMovementActuator.h:523
DtVortexBasePart * findPart(int partId) const
Gets the Vortex part associated with an articulated part ID.
State repository for Vortex physics entities.
Definition vortexStateRepository.h:54
Listener for Vortex file loading events.
Definition vortexMovementActuator.h:607
virtual ~DtVxSimulationFileManagerFacadeListener() override
Destructor.
DtVxSimulationFileManagerFacadeListener(DtVortexMovementActuator *actuator)
Constructor.
DtVortexMovementActuator * myMovementActuator
The movement actuator.
Definition vortexMovementActuator.h:625
virtual void onRequestedObjectLoaded(const VxSim::VxUuid &requestId, const std::string &name, RequestResult result) override
Called when a requested object has been loaded.
Descriptor for Vortex physics engine configurations.
Definition vortexConfigurationDescriptor.h:27
Main class for managing Vortex configuration parameters.
Definition vortexConfiguration.h:146
Descriptor for Vortex physics engine interfaces.
Definition vortexInterfaceDescriptor.h:27
Process state repository for the Vortex movement actuator.
Definition vortexMovementPSR.h:31
Main class responsible for managing the Vortex physics simulation environment.
Definition vortexPhysicalWorld.h:55
Articulated part descriptor for Vortex physics simulation.
Definition vortexArtPartDescriptor.h:27
Provides coordinate conversion functionality between different coordinate systems.
Export macros for the VR-Forces Vortex extension library.
#define VREVRFVORTEX_DLL
Export macro for non-Windows platforms.
Definition export.h:30
Definition vortexConfiguration.h:29
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
const char DtVortexMovementActuatorType[]
Type identifier for the Vortex movement actuator.
Definition vortexMovementActuator.h:73