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

Detailed Description

This class extends the basic turreted ballistic gun PSR to provide VREngage-specific functionality for ballistic gun weapons. It adds support for managing projectiles in flight, including tracking and updating their positions and handling detonation events. This is used to implement more realistic ballistic behavior in VREngage.

#include <vreVrfBalGunPSR.h>

Inheritance diagram for makVre::DtVreVrfBalGunPSR:
[legend]

Public Member Functions

 DtVreVrfBalGunPSR (DtLocalObject *vrfObject, const DtString &rwName=DtString::nullString(), DtReaderWriterRegistry *parentRegistry=0)
 
 DtVreVrfBalGunPSR (const DtVreVrfBalGunPSR &orig, const DtString &rwName=DtString::nullString(), DtReaderWriterRegistry *parentRegistry=0)
 
virtual ~DtVreVrfBalGunPSR () override
 
DtVreVrfBalGunPSRoperator= (const DtVreVrfBalGunPSR &orig)
 
virtual DtVrfProcessStateRepository * clone (const DtString &rwName=DtString::nullString(), DtReaderWriterRegistry *parentRegistry=0) const override
 
virtual DtString type () const override
 
virtual void setPhysicalWorld (DtPhysicalWorld *physicalWorld)
 
virtual void setFiringEntity (DtSimObject *firingEntity)
 
virtual void addProjectile (const DtProjectile &projectile)
 
virtual void removeAllProjectiles ()
 
virtual std::list< DtProjectileDetonationResultupdateProjectiles (double deltaTime)
 
virtual void getSelf (DtlObjPtr args, const DtReaderWriter::SearchPaths &searchPaths, const DtVariableBindingsList &variableBindings) override
 

Static Public Member Functions

static DtVrfProcessStateRepository * creator (const DtString &rwName, DtLocalObject *vrfObject, DtReaderWriterRegistry *parentRegistry)
 

Protected Attributes

DtProjectileList myProjectileList
 
DtPhysicalWorld * myPhysicalWorld
 
DtSimObject * myFiringEntity
 

Constructor & Destructor Documentation

◆ DtVreVrfBalGunPSR() [1/2]

makVre::DtVreVrfBalGunPSR::DtVreVrfBalGunPSR ( DtLocalObject * vrfObject,
const DtString & rwName = DtString::nullString(),
DtReaderWriterRegistry * parentRegistry = 0 )

Constructor with VRF object and optional name.

Parameters
vrfObjectPointer to the local object this PSR is associated with
rwNameOptional reader/writer name
parentRegistryOptional parent registry for reader/writer functionality

Creates a new ballistic gun PSR for the specified VRF object.

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

◆ DtVreVrfBalGunPSR() [2/2]

makVre::DtVreVrfBalGunPSR::DtVreVrfBalGunPSR ( const DtVreVrfBalGunPSR & orig,
const DtString & rwName = DtString::nullString(),
DtReaderWriterRegistry * parentRegistry = 0 )

Copy constructor.

Parameters
origThe source PSR to copy from
rwNameOptional reader/writer name
parentRegistryOptional parent registry for reader/writer functionality

Creates a new ballistic gun PSR as a copy of the provided original.

References DtVreVrfBalGunPSR().

◆ ~DtVreVrfBalGunPSR()

virtual makVre::DtVreVrfBalGunPSR::~DtVreVrfBalGunPSR ( )
inlineoverridevirtual

Virtual destructor.

Cleans up resources used by the PSR.

Member Function Documentation

◆ operator=()

DtVreVrfBalGunPSR & makVre::DtVreVrfBalGunPSR::operator= ( const DtVreVrfBalGunPSR & orig)

Assignment operator.

Parameters
origThe source PSR to copy from
Returns
Reference to this PSR after assignment

Assigns the contents of the provided PSR to this one.

References DtVreVrfBalGunPSR().

◆ clone()

virtual DtVrfProcessStateRepository * makVre::DtVreVrfBalGunPSR::clone ( const DtString & rwName = DtString::nullString(),
DtReaderWriterRegistry * parentRegistry = 0 ) const
overridevirtual

Creates a clone of this PSR.

Parameters
rwNameOptional reader/writer name for the clone
parentRegistryOptional parent registry for reader/writer functionality
Returns
Pointer to a new PSR that is a clone of this one

Creates a new ballistic gun PSR as a deep copy of this one.

◆ type()

virtual DtString makVre::DtVreVrfBalGunPSR::type ( ) const
overridevirtual

Gets the type identifier for this PSR.

Returns
String identifying this PSR type

Returns a unique type identifier string for this PSR type. Will return DtVreVrfBalGunPSRType.

◆ setPhysicalWorld()

virtual void makVre::DtVreVrfBalGunPSR::setPhysicalWorld ( DtPhysicalWorld * physicalWorld)
virtual

Sets the physical world pointer.

Parameters
physicalWorldPointer to the physical world

Sets a pointer to the physical world, caching it so it can be passed on to any DtProjectile objects the PSR is maintaining. This is needed when reading in the contents of the projectile list from the order of battle, and for projectile collision detection with terrain.

◆ setFiringEntity()

virtual void makVre::DtVreVrfBalGunPSR::setFiringEntity ( DtSimObject * firingEntity)
virtual

Sets the firing entity.

Parameters
firingEntityPointer to the entity that is firing the weapon

Sets the identity of the firing entity, caching it so it can be passed on to any DtProjectile objects the PSR is maintaining. This is needed when reading in the contents of the projectile list from the order of battle, and for tracking which entity fired each projectile.

◆ addProjectile()

virtual void makVre::DtVreVrfBalGunPSR::addProjectile ( const DtProjectile & projectile)
virtual

Adds a projectile to the tracking list.

Parameters
projectileThe projectile to add

Adds a new projectile to the set of projectiles being tracked by this PSR. The projectile's position will be updated during calls to updateProjectiles(). A copy of the projectile is made and stored in the internal projectile list.

◆ removeAllProjectiles()

virtual void makVre::DtVreVrfBalGunPSR::removeAllProjectiles ( )
virtual

Removes all tracked projectiles.

Removes and destroys all projectiles currently being tracked by this PSR. This is typically called when the weapon is destroyed or when clearing the simulation state.

◆ updateProjectiles()

virtual std::list< DtProjectileDetonationResult > makVre::DtVreVrfBalGunPSR::updateProjectiles ( double deltaTime)
virtual

Updates all tracked projectiles.

Parameters
deltaTimeTime elapsed since the last update in seconds
Returns
List of detonation results for projectiles that detonated during this update

Iterates over the list of active projectiles, calling their update() function to update their positions based on physics. For any projectiles that detonate (hit something or reach maximum range), they are removed from the list and information about their detonation is returned.

◆ getSelf()

virtual void makVre::DtVreVrfBalGunPSR::getSelf ( DtlObjPtr args,
const DtReaderWriter::SearchPaths & searchPaths,
const DtVariableBindingsList & variableBindings )
overridevirtual

Processes an MTL stream to initialize this PSR.

Parameters
argsInput stream from an MTL file
searchPathsSearch paths for resolving references
variableBindingsVariable bindings for resolving references

Overrides the base class getSelf method to handle reading the projectile list and other VREngage-specific ballistic gun state from an MTL stream.

◆ creator()

static DtVrfProcessStateRepository * makVre::DtVreVrfBalGunPSR::creator ( const DtString & rwName,
DtLocalObject * vrfObject,
DtReaderWriterRegistry * parentRegistry )
static

Factory function to create a new instance of this PSR.

Parameters
rwNameThe reader/writer name for the new instance
vrfObjectPointer to the local object this PSR will be associated with
parentRegistryParent registry for reader/writer functionality
Returns
Pointer to a newly created PSR instance

Static factory function used by the PSR creation system to instantiate new instances of this PSR type.

Member Data Documentation

◆ myProjectileList

DtProjectileList makVre::DtVreVrfBalGunPSR::myProjectileList
protected

List of tracked projectiles.

Stores the list of projectiles whose positions are updated every frame. This list is managed by addProjectile(), removeAllProjectiles(), and updateProjectiles().

◆ myPhysicalWorld

DtPhysicalWorld* makVre::DtVreVrfBalGunPSR::myPhysicalWorld
protected

Pointer to the physical world.

Stores a pointer to the physical world for terrain queries and gravity direction. This is passed to projectiles so they can detect collisions with terrain.

◆ myFiringEntity

DtSimObject* makVre::DtVreVrfBalGunPSR::myFiringEntity
protected

Pointer to the firing entity.

Stores a pointer to the entity that is firing the weapon. This is passed to projectiles so they know which entity fired them.


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