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

Detailed Description

DtObjectProximitySensor extends the base proximity sensor to detect specific objects that come within a configurable detection range. It provides notifications when objects enter or exit the sensor's range, and maintains a list of currently detected objects. The component also supports integration with front-end visualization systems and provides Lua bindings for scripting access.

#include <objectProximitySensor.h>

Inheritance diagram for makVre::DtObjectProximitySensor:
[legend]

Public Member Functions

 DtObjectProximitySensor (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 
virtual ~DtObjectProximitySensor () override
 
virtual const char * type () const override
 
virtual bool init () override
 
virtual void tick () override
 
virtual void disable () override
 
virtual void setIsEnabled (bool yesNo) override
 
- Public Member Functions inherited from makVre::DtVreSimComponent< DtSimpleProximitySensor >
 DtVreSimComponent (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 
virtual ~DtVreSimComponent ()
 
bool isPlayerControlled (const std::string &role="") const
 
DtString entitySystemName () const
 

Static Public Member Functions

static DtSimComponent * creator (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 

Protected Member Functions

virtual bool createAndInitSensorMonitor ()
 
virtual bool processObjects ()
 
virtual bool processDynamicTerrainObjects (std::set< DtUUID > &contactNames, std::string searchFor, DtEntityType sendAsType)
 

Protected Attributes

DtObjectProximitySensorMonitormyMonitor
 

Private Member Functions

 DtObjectProximitySensor ()
 
 DtObjectProximitySensor (const DtObjectProximitySensor &orig)
 
const DtObjectProximitySensoroperator= (const DtObjectProximitySensor &orig)
 

Constructor & Destructor Documentation

◆ DtObjectProximitySensor() [1/3]

makVre::DtObjectProximitySensor::DtObjectProximitySensor ( )
private

Default constructor (not implemented)

Default constructor is private and not implemented to prevent creation of instances without proper initialization.

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

◆ DtObjectProximitySensor() [2/3]

makVre::DtObjectProximitySensor::DtObjectProximitySensor ( const DtObjectProximitySensor & orig)
private

Copy constructor (not implemented)

Copy constructor is private and not implemented to prevent copy construction.

References DtObjectProximitySensor().

◆ DtObjectProximitySensor() [3/3]

makVre::DtObjectProximitySensor::DtObjectProximitySensor ( const DtString & name,
DtLocalObject * owner,
DtSimulationServices * simManager,
DtComponentDescriptor * desc = 0,
DtReaderWriterRegistry * parentRegistry = 0 )

Constructor.

Parameters
nameThe name of this component
ownerThe local object that owns this component
simManagerThe simulation services manager
descOptional component descriptor with configuration parameters
parentRegistryOptional parent registry for reader/writer functionality

Creates a new object proximity sensor component with the specified parameters.

◆ ~DtObjectProximitySensor()

virtual makVre::DtObjectProximitySensor::~DtObjectProximitySensor ( )
overridevirtual

Virtual destructor.

Cleans up resources used by the object proximity sensor component, including the sensor monitor.

Member Function Documentation

◆ operator=()

const DtObjectProximitySensor & makVre::DtObjectProximitySensor::operator= ( const DtObjectProximitySensor & orig)
private

Assignment operator (not implemented)

Returns
Reference to this object

Assignment operator is private and not implemented to prevent assignment.

References DtObjectProximitySensor().

◆ type()

virtual const char * makVre::DtObjectProximitySensor::type ( ) const
overridevirtual

Gets the type identifier for this component.

Returns
String identifying the component type (DtObjectProximitySensorType)

Implements the DtSimComponent::type() method to return the type identifier for this component.

◆ init()

virtual bool makVre::DtObjectProximitySensor::init ( )
overridevirtual

Initializes the component.

Returns
True if initialization is successful, false otherwise

Performs component initialization, setting up the sensor monitor and configuring detection parameters based on the component descriptor.

◆ tick()

virtual void makVre::DtObjectProximitySensor::tick ( )
overridevirtual

Updates the sensor state each simulation frame.

Processes sensor detection logic each frame, but only if the simulation is not paused. Detects objects that have entered or exited the sensor's range and updates the sensor monitor accordingly.

◆ disable()

virtual void makVre::DtObjectProximitySensor::disable ( )
overridevirtual

Disables the sensor component.

Overridden to clear out the target list and update the monitor when the sensor is disabled, ensuring the sensor contact list is properly cleared in the front-end visualization.

◆ setIsEnabled()

virtual void makVre::DtObjectProximitySensor::setIsEnabled ( bool yesNo)
overridevirtual

Sets the enabled state of the sensor component.

Parameters
yesNoTrue to enable the sensor, false to disable it

Overridden to properly handle the sensor's enabled state, ensuring that the target list and monitor are updated appropriately when the state changes.

◆ creator()

static DtSimComponent * makVre::DtObjectProximitySensor::creator ( const DtString & name,
DtLocalObject * owner,
DtSimulationServices * simManager,
DtComponentDescriptor * desc = 0,
DtReaderWriterRegistry * parentRegistry = 0 )
static

Factory method to create a new instance of this component.

Parameters
nameThe name for the new component
ownerThe local object that will own this component
simManagerThe simulation services manager
descOptional component descriptor
parentRegistryOptional parent registry for reader/writer functionality
Returns
Pointer to the newly created component

Static factory method used by the component creation system to instantiate new instances of this component type.

◆ createAndInitSensorMonitor()

virtual bool makVre::DtObjectProximitySensor::createAndInitSensorMonitor ( )
protectedvirtual

Creates and initializes the sensor monitor.

Returns
True if monitor creation and initialization succeeds, false otherwise

Creates a DtObjectProximitySensorMonitor instance and initializes it, establishing the connection between the sensor and the front-end visualization system.

◆ processObjects()

virtual bool makVre::DtObjectProximitySensor::processObjects ( )
protectedvirtual

Processes detected objects in the sensor's range.

Returns
True if the status of any detected objects changed, false otherwise

Performs detection checks for objects within the sensor's range, updating the list of detected objects and notifying the sensor monitor of any changes.

◆ processDynamicTerrainObjects()

virtual bool makVre::DtObjectProximitySensor::processDynamicTerrainObjects ( std::set< DtUUID > & contactNames,
std::string searchFor,
DtEntityType sendAsType )
protectedvirtual

Processes dynamic terrain objects for detection.

Parameters
contactNamesSet of UUIDs for contact objects being tracked
searchForString pattern to search for in dynamic terrain objects
sendAsTypeEntity type to use when reporting detections
Returns
True if any dynamic terrain objects were detected, false otherwise

Searches for dynamic terrain objects matching the specified pattern and adds them to the sensor's detection list when found within range.

Member Data Documentation

◆ myMonitor

DtObjectProximitySensorMonitor* makVre::DtObjectProximitySensor::myMonitor
protected

Pointer to the sensor monitor.

The monitor object that handles communication between the sensor and the front-end visualization system. Maintains the list of detected objects and their properties for display.


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