VR-Engage  2.2
Loading...
Searching...
No Matches
makVre::DtVortexCollisionProxyGenerator Class Reference

Detailed Description

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
 
DtVortexCollisionProxyGeneratoroperator= (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
 
DtCoordinateConvertmyCoordConverter
 
std::vector< DtUUID > myVortexVehicles
 
std::map< DtUUID, std::vector< DtVrfProxyVehicle > > myClosestVehicleMap
 
DtVortexPhysicalWorldmyVortexPhysicalWorld
 
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
 

Constructor & Destructor Documentation

◆ DtVortexCollisionProxyGenerator() [1/3]

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.

Parameters
worldPointer to the Vortex physical world
cgfPointer to the CGF instance for callback registration

Referenced by DtVortexCollisionProxyGenerator(), and operator=().

◆ ~DtVortexCollisionProxyGenerator()

virtual makVre::DtVortexCollisionProxyGenerator::~DtVortexCollisionProxyGenerator ( )
virtual

Destructor.

Cleans up all proxy vehicles from the Vortex universe and clears data structures.

◆ DtVortexCollisionProxyGenerator() [2/3]

makVre::DtVortexCollisionProxyGenerator::DtVortexCollisionProxyGenerator ( )
delete

Default constructor, copy constructor, and copy assignment operator not allowed.

◆ DtVortexCollisionProxyGenerator() [3/3]

makVre::DtVortexCollisionProxyGenerator::DtVortexCollisionProxyGenerator ( const DtVortexCollisionProxyGenerator & )
delete

Member Function Documentation

◆ operator=()

DtVortexCollisionProxyGenerator & makVre::DtVortexCollisionProxyGenerator::operator= ( const DtVortexCollisionProxyGenerator & )
delete

◆ update()

virtual void makVre::DtVortexCollisionProxyGenerator::update ( )
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.

◆ addVortexVehicle()

virtual void makVre::DtVortexCollisionProxyGenerator::addVortexVehicle ( const DtUUID & uuid)
virtual

Adds a Vortex vehicle to the tracked vehicles list.

Registers a new Vortex-simulated vehicle by its UUID for collision handling.

Parameters
uuidThe UUID of the Vortex vehicle to track

◆ removeVortexVehicle()

virtual void makVre::DtVortexCollisionProxyGenerator::removeVortexVehicle ( const DtUUID & uuid)
virtual

Removes a Vortex vehicle from the tracked vehicles list.

Unregisters a Vortex-simulated vehicle and removes its associated proxy vehicles.

Parameters
uuidThe UUID of the Vortex vehicle to stop tracking

◆ setTypesToCollideWith()

virtual void makVre::DtVortexCollisionProxyGenerator::setTypesToCollideWith ( std::vector< DtEntityType > entityTypes)
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.

Parameters
entityTypesVector of entity types to consider for collision detection

◆ rewindCallback()

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.

◆ renderImgui()

virtual void makVre::DtVortexCollisionProxyGenerator::renderImgui ( )
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.

◆ clearDataStructures()

virtual void makVre::DtVortexCollisionProxyGenerator::clearDataStructures ( )
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.

Note
This method removes proxy vehicles from the Vortex universe before clearing the data structures to ensure proper cleanup.

◆ isPlayerControlled()

virtual bool makVre::DtVortexCollisionProxyGenerator::isPlayerControlled ( const DtSimObject & vehicle) const
protectedvirtual

Checks if a vehicle is player controlled.

Determines if a given vehicle is currently being controlled by a player as a driver.

Parameters
vehicleThe vehicle to check
Returns
True if the vehicle is player controlled, false otherwise

◆ addProxyVehicleToVortexUniverse()

void makVre::DtVortexCollisionProxyGenerator::addProxyVehicleToVortexUniverse ( const DtVrfProxyVehicle & vreProxyVehicle)
protected

Adds a proxy vehicle to the Vortex physics universe.

Creates a Vortex VxPart representation of a VR-Forces vehicle for collision detection.

Parameters
vreProxyVehicleThe proxy vehicle to add to the Vortex universe

◆ updateProxyVehicleInVortexUniverse()

void makVre::DtVortexCollisionProxyGenerator::updateProxyVehicleInVortexUniverse ( const DtUUID & proxyVehicleUUID,
const DtUUID & vortexVehicleUUID )
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.

Parameters
proxyVehicleUUIDThe UUID of the proxy vehicle to update
vortexVehicleUUIDThe UUID of the corresponding Vortex vehicle

◆ removeProxyVehicleFromVortexUniverse()

void makVre::DtVortexCollisionProxyGenerator::removeProxyVehicleFromVortexUniverse ( Vx::VxPart * VxProxyVehicle)
protected

Removes a proxy vehicle from the Vortex universe.

Deletes a proxy vehicle's Vortex representation and updates the tracking maps.

Parameters
VxProxyVehiclePointer to the Vortex part representing the proxy vehicle

◆ updateClosestVehicleList()

virtual void makVre::DtVortexCollisionProxyGenerator::updateClosestVehicleList ( const DtUUID & uuid)
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.

Parameters
uuidThe UUID of the Vortex vehicle to update proxies for

◆ clearDistantVehicles()

virtual void makVre::DtVortexCollisionProxyGenerator::clearDistantVehicles ( const DtUUID & uuid)
protectedvirtual

Removes proxy vehicles that are no longer within the search radius.

Cleans up proxies that have moved away from the specified Vortex vehicle.

Parameters
uuidThe UUID of the Vortex vehicle to check proxies against

◆ collectNearbySimObjects()

virtual void makVre::DtVortexCollisionProxyGenerator::collectNearbySimObjects ( const DtVector & searchCenter,
std::vector< const DtSimObject * > & results )
protectedvirtual

Collects nearby simulation objects around a search center.

Finds all simulated objects of appropriate types within the search radius of the specified position.

Parameters
searchCenterThe center point for the search
resultsVector to be filled with pointers to nearby objects

◆ handleVortexCollision()

virtual void makVre::DtVortexCollisionProxyGenerator::handleVortexCollision ( Vx::VxPart * part0,
Vx::VxPart * part1 )
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.

Parameters
part0First Vortex part involved in the collision
part1Second Vortex part involved in the collision

◆ toVxCoords()

virtual VxMath::Vector3 makVre::DtVortexCollisionProxyGenerator::toVxCoords ( const DtVector & vec)
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.

Parameters
vecPosition vector in VR-Forces coordinates
Returns
Equivalent position vector in Vortex coordinates

Member Data Documentation

◆ myNumProxyVehicles

int makVre::DtVortexCollisionProxyGenerator::myNumProxyVehicles
protected

Number of nearby non-Vortex vehicles to track for each Vortex vehicle.

◆ mySearchRadius

int makVre::DtVortexCollisionProxyGenerator::mySearchRadius
protected

Maximum distance in meters to search for nearby vehicles.

◆ myDefaultVrfVehicleMass

double makVre::DtVortexCollisionProxyGenerator::myDefaultVrfVehicleMass
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.

◆ myLastCollisionInteractionTime

DtTime makVre::DtVortexCollisionProxyGenerator::myLastCollisionInteractionTime
protected

Timestamp of the last sent collision interaction.

Used to limit the frequency of collision events for performance reasons.

◆ myTerrainIsGeocentric

bool makVre::DtVortexCollisionProxyGenerator::myTerrainIsGeocentric
protected

Flag indicating if the terrain uses geocentric coordinates.

◆ myCoordConverterIsSet

bool makVre::DtVortexCollisionProxyGenerator::myCoordConverterIsSet
protected

Flag indicating if the coordinate converter has been set.

◆ myCoordConverter

DtCoordinateConvert* makVre::DtVortexCollisionProxyGenerator::myCoordConverter
protected

Coordinate converter for geocentric/local transformations.

◆ myVortexVehicles

std::vector<DtUUID> makVre::DtVortexCollisionProxyGenerator::myVortexVehicles
protected

List of UUIDs for all Vortex vehicles being tracked.

◆ myClosestVehicleMap

std::map<DtUUID, std::vector<DtVrfProxyVehicle> > makVre::DtVortexCollisionProxyGenerator::myClosestVehicleMap
protected

Map from Vortex vehicle UUIDs to lists of nearby proxy vehicles.

◆ myVortexPhysicalWorld

DtVortexPhysicalWorld* makVre::DtVortexCollisionProxyGenerator::myVortexPhysicalWorld
protected

Pointer to the Vortex physical world.

◆ myProxyVehiclesInUniverse

std::vector<Vx::VxPart*> makVre::DtVortexCollisionProxyGenerator::myProxyVehiclesInUniverse
protected

List of all proxy vehicle parts in the Vortex universe.

Cached for efficient cleanup during destruction.

◆ myVxPartToUUIDMap

std::map<Vx::VxPart*, DtUUID> makVre::DtVortexCollisionProxyGenerator::myVxPartToUUIDMap
protected

Mapping from Vortex parts to VR-Forces UUIDs.

◆ myUUIDToVxPartMap

std::map<DtUUID, Vx::VxPart*> makVre::DtVortexCollisionProxyGenerator::myUUIDToVxPartMap
protected

Mapping from VR-Forces UUIDs to Vortex parts.

◆ myObjectTypesToCollideWith

std::vector<DtEntityType> makVre::DtVortexCollisionProxyGenerator::myObjectTypesToCollideWith
protected

List of entity types that Vortex vehicles will collide with.

◆ myCollideableObjectTypesPredicate

DtCompositePredicate makVre::DtVortexCollisionProxyGenerator::myCollideableObjectTypesPredicate
protected

Predicate for filtering objects by their types.

◆ myMutex

tbb::spin_mutex makVre::DtVortexCollisionProxyGenerator::myMutex
protected

Mutex for thread-safe access to data structures.


The documentation for this class was generated from the following file: