|
VR-Engage
2.2
|
This class tracks VR-Forces (non-Vortex) vehicles using proxy representations and creates corresponding collision geometries in the Vortex physics universe. It maintains lists of nearby vehicles for each Vortex-simulated vehicle, updates their positions, and processes collision events between Vortex and non-Vortex objects.
#include <vortexCollisionProxyGenerator.h>
Classes | |
| struct | DtVrfProxyVehicle |
Public Member Functions | |
| DtVortexCollisionProxyGenerator (DtVortexPhysicalWorld *world, DtCgf *cgf) | |
| virtual | ~DtVortexCollisionProxyGenerator () |
| DtVortexCollisionProxyGenerator ()=delete | |
| DtVortexCollisionProxyGenerator (const DtVortexCollisionProxyGenerator &)=delete | |
| DtVortexCollisionProxyGenerator & | operator= (const DtVortexCollisionProxyGenerator &)=delete |
| virtual void | update () |
| virtual void | addVortexVehicle (const DtUUID &uuid) |
| virtual void | removeVortexVehicle (const DtUUID &uuid) |
| virtual void | setTypesToCollideWith (std::vector< DtEntityType > entityTypes) |
| void | rewindCallback () |
| virtual void | renderImgui () |
| virtual void | clearDataStructures () |
Protected Member Functions | |
| virtual bool | isPlayerControlled (const DtSimObject &vehicle) const |
| void | addProxyVehicleToVortexUniverse (const DtVrfProxyVehicle &vreProxyVehicle) |
| void | updateProxyVehicleInVortexUniverse (const DtUUID &proxyVehicleUUID, const DtUUID &vortexVehicleUUID) |
| void | removeProxyVehicleFromVortexUniverse (Vx::VxPart *VxProxyVehicle) |
| virtual void | updateClosestVehicleList (const DtUUID &uuid) |
| virtual void | clearDistantVehicles (const DtUUID &uuid) |
| virtual void | collectNearbySimObjects (const DtVector &searchCenter, std::vector< const DtSimObject * > &results) |
| virtual void | handleVortexCollision (Vx::VxPart *part0, Vx::VxPart *part1) |
| virtual VxMath::Vector3 | toVxCoords (const DtVector &vec) |
Protected Attributes | |
| int | myNumProxyVehicles |
| int | mySearchRadius |
| double | myDefaultVrfVehicleMass |
| DtTime | myLastCollisionInteractionTime |
| bool | myTerrainIsGeocentric |
| bool | myCoordConverterIsSet |
| DtCoordinateConvert * | myCoordConverter |
| std::vector< DtUUID > | myVortexVehicles |
| std::map< DtUUID, std::vector< DtVrfProxyVehicle > > | myClosestVehicleMap |
| DtVortexPhysicalWorld * | myVortexPhysicalWorld |
| std::vector< Vx::VxPart * > | myProxyVehiclesInUniverse |
| std::map< Vx::VxPart *, DtUUID > | myVxPartToUUIDMap |
| std::map< DtUUID, Vx::VxPart * > | myUUIDToVxPartMap |
| std::vector< DtEntityType > | myObjectTypesToCollideWith |
| DtCompositePredicate | myCollideableObjectTypesPredicate |
| tbb::spin_mutex | myMutex |
| makVre::DtVortexCollisionProxyGenerator::DtVortexCollisionProxyGenerator | ( | DtVortexPhysicalWorld * | world, |
| DtCgf * | cgf ) |
Constructor.
Initializes the collision proxy generator with the provided physical world and CGF instance. Sets up default values for proxy count, search radius, and vehicle mass.
| world | Pointer to the Vortex physical world |
| cgf | Pointer to the CGF instance for callback registration |
Referenced by DtVortexCollisionProxyGenerator(), and operator=().
|
virtual |
Destructor.
Cleans up all proxy vehicles from the Vortex universe and clears data structures.
|
delete |
Default constructor, copy constructor, and copy assignment operator not allowed.
|
delete |
References DtVortexCollisionProxyGenerator().
|
delete |
References DtVortexCollisionProxyGenerator().
|
virtual |
Updates lists of nearest vehicles and checks for collisions.
Called each simulation frame to update the positions of proxy vehicles in the Vortex universe and process any collisions that occurred.
|
virtual |
Adds a Vortex vehicle to the tracked vehicles list.
Registers a new Vortex-simulated vehicle by its UUID for collision handling.
| uuid | The UUID of the Vortex vehicle to track |
|
virtual |
Removes a Vortex vehicle from the tracked vehicles list.
Unregisters a Vortex-simulated vehicle and removes its associated proxy vehicles.
| uuid | The UUID of the Vortex vehicle to stop tracking |
|
virtual |
Sets the entity types that Vortex vehicles will collide with.
Updates the filter for determining which object types should be considered for collision detection with Vortex-simulated vehicles.
| entityTypes | Vector of entity types to consider for collision detection |
| void makVre::DtVortexCollisionProxyGenerator::rewindCallback | ( | ) |
Callback executed when a scenario is rewound.
Clears all vehicle lists and mappings to prevent accessing invalid data after a scenario rewind operation.
|
virtual |
Renders ImGui debug interface for collision proxy visualization.
Provides a graphical user interface for debugging and monitoring the collision proxy generator's state, including tracked vehicles and active proxies. Override this method to customize debug visualization.
|
virtual |
Clears all internal data structures.
Removes all tracked Vortex vehicles, proxy vehicles from the universe, and clears all internal mappings between UUIDs and Vortex parts. This method is called during destruction and scenario rewind to ensure clean state and prevent accessing invalidated data.
|
protectedvirtual |
Checks if a vehicle is player controlled.
Determines if a given vehicle is currently being controlled by a player as a driver.
| vehicle | The vehicle to check |
|
protected |
Adds a proxy vehicle to the Vortex physics universe.
Creates a Vortex VxPart representation of a VR-Forces vehicle for collision detection.
| vreProxyVehicle | The proxy vehicle to add to the Vortex universe |
|
protected |
Updates the position of a proxy vehicle in the Vortex universe.
Adjusts the position and orientation of a proxy vehicle's Vortex representation to match its current state in VR-Forces.
| proxyVehicleUUID | The UUID of the proxy vehicle to update |
| vortexVehicleUUID | The UUID of the corresponding Vortex vehicle |
|
protected |
Removes a proxy vehicle from the Vortex universe.
Deletes a proxy vehicle's Vortex representation and updates the tracking maps.
| VxProxyVehicle | Pointer to the Vortex part representing the proxy vehicle |
|
protectedvirtual |
Updates the list of closest vehicles for a given Vortex vehicle.
Finds the nearest non-Vortex vehicles to a specified Vortex vehicle and creates or updates proxy representations for them.
| uuid | The UUID of the Vortex vehicle to update proxies for |
|
protectedvirtual |
Removes proxy vehicles that are no longer within the search radius.
Cleans up proxies that have moved away from the specified Vortex vehicle.
| uuid | The UUID of the Vortex vehicle to check proxies against |
|
protectedvirtual |
Collects nearby simulation objects around a search center.
Finds all simulated objects of appropriate types within the search radius of the specified position.
| searchCenter | The center point for the search |
| results | Vector to be filled with pointers to nearby objects |
|
protectedvirtual |
Handles a collision between two Vortex parts.
Processes a collision detected by the Vortex physics engine, generates appropriate VR-Forces collision events, and removes the proxy to prevent persistent collisions.
| part0 | First Vortex part involved in the collision |
| part1 | Second Vortex part involved in the collision |
|
protectedvirtual |
Converts from VR-Forces coordinates to Vortex coordinates.
Translates position vectors between coordinate systems based on whether the terrain is geocentric or local/flat.
| vec | Position vector in VR-Forces coordinates |
|
protected |
Number of nearby non-Vortex vehicles to track for each Vortex vehicle.
|
protected |
Maximum distance in meters to search for nearby vehicles.
|
protected |
Default mass in kg for non-Vortex vehicles.
This value is used when creating collision proxies in the Vortex universe. It's deliberately set high to make the vehicles behave as heavy objects.
|
protected |
Timestamp of the last sent collision interaction.
Used to limit the frequency of collision events for performance reasons.
|
protected |
Flag indicating if the terrain uses geocentric coordinates.
|
protected |
Flag indicating if the coordinate converter has been set.
|
protected |
Coordinate converter for geocentric/local transformations.
|
protected |
List of UUIDs for all Vortex vehicles being tracked.
|
protected |
Map from Vortex vehicle UUIDs to lists of nearby proxy vehicles.
|
protected |
Pointer to the Vortex physical world.
|
protected |
List of all proxy vehicle parts in the Vortex universe.
Cached for efficient cleanup during destruction.
|
protected |
Mapping from Vortex parts to VR-Forces UUIDs.
|
protected |
Mapping from VR-Forces UUIDs to Vortex parts.
|
protected |
List of entity types that Vortex vehicles will collide with.
|
protected |
Predicate for filtering objects by their types.
|
protected |
Mutex for thread-safe access to data structures.