|
VR-Engage
2.2
|
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>
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 |
| DtVreVrfBalGunPSR & | operator= (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< DtProjectileDetonationResult > | updateProjectiles (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 |
| makVre::DtVreVrfBalGunPSR::DtVreVrfBalGunPSR | ( | DtLocalObject * | vrfObject, |
| const DtString & | rwName = DtString::nullString(), | ||
| DtReaderWriterRegistry * | parentRegistry = 0 ) |
Constructor with VRF object and optional name.
| vrfObject | Pointer to the local object this PSR is associated with |
| rwName | Optional reader/writer name |
| parentRegistry | Optional parent registry for reader/writer functionality |
Creates a new ballistic gun PSR for the specified VRF object.
Referenced by DtVreVrfBalGunPSR(), and operator=().
| makVre::DtVreVrfBalGunPSR::DtVreVrfBalGunPSR | ( | const DtVreVrfBalGunPSR & | orig, |
| const DtString & | rwName = DtString::nullString(), | ||
| DtReaderWriterRegistry * | parentRegistry = 0 ) |
Copy constructor.
| orig | The source PSR to copy from |
| rwName | Optional reader/writer name |
| parentRegistry | Optional parent registry for reader/writer functionality |
Creates a new ballistic gun PSR as a copy of the provided original.
References DtVreVrfBalGunPSR().
|
inlineoverridevirtual |
Virtual destructor.
Cleans up resources used by the PSR.
| DtVreVrfBalGunPSR & makVre::DtVreVrfBalGunPSR::operator= | ( | const DtVreVrfBalGunPSR & | orig | ) |
Assignment operator.
| orig | The source PSR to copy from |
Assigns the contents of the provided PSR to this one.
References DtVreVrfBalGunPSR().
|
overridevirtual |
Creates a clone of this PSR.
| rwName | Optional reader/writer name for the clone |
| parentRegistry | Optional parent registry for reader/writer functionality |
Creates a new ballistic gun PSR as a deep copy of this one.
|
overridevirtual |
Gets the type identifier for this PSR.
Returns a unique type identifier string for this PSR type. Will return DtVreVrfBalGunPSRType.
|
virtual |
Sets the physical world pointer.
| physicalWorld | Pointer 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.
|
virtual |
Sets the firing entity.
| firingEntity | Pointer 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.
|
virtual |
Adds a projectile to the tracking list.
| projectile | The 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.
|
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.
|
virtual |
Updates all tracked projectiles.
| deltaTime | Time elapsed since the last update in seconds |
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.
|
overridevirtual |
Processes an MTL stream to initialize this PSR.
| args | Input stream from an MTL file |
| searchPaths | Search paths for resolving references |
| variableBindings | Variable 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.
|
static |
Factory function to create a new instance of this PSR.
| rwName | The reader/writer name for the new instance |
| vrfObject | Pointer to the local object this PSR will be associated with |
| parentRegistry | Parent registry for reader/writer functionality |
Static factory function used by the PSR creation system to instantiate new instances of this PSR type.
|
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().
|
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.
|
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.