VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
makVrv::DtFiringSystem Class Reference

Controls weapon firing mechanics, timing, and spread.

Public Types

using FireCallback = std::function< void(const dvec3 &, const dvec3 &)>
 

Public Member Functions

 DtFiringSystem ()
 
virtual ~DtFiringSystem ()
 
virtual void setFiringMode (DtFiringMode mode)
 
virtual DtFiringMode firingMode () const
 
virtual void setFireRate (double roundsPerMinute)
 
virtual double fireRate () const
 
virtual void setBurstCount (int rounds)
 
virtual int burstCount () const
 
virtual void setBulletDefinition (const DtBulletDefinition &bullet)
 
virtual const DtBulletDefinition * bulletDefinition () const
 
virtual void startFiring (const dvec3 &origin, const dvec3 &direction)
 
virtual void stopFiring ()
 
virtual void update (double deltaTime)
 
virtual DtAccuracyModel & accuracyModel ()
 
virtual const DtAccuracyModel & accuracyModel () const
 
virtual void registerFireCallback (FireCallback callback)
 
virtual bool isFiring () const
 
virtual double timeSinceLastShot () const
 
virtual int burstRoundsFired () const
 
virtual const dvec3 & firingOrigin () const
 
virtual const dvec3 & firingDirection () const
 
virtual void setTimeSinceLastShot (double time)
 
virtual void setBurstRoundsFired (int count)
 
virtual void setFiringOrigin (const dvec3 &origin)
 
virtual void setFiringDirection (const dvec3 &direction)
 
virtual void setIsFiring (bool firing)
 
virtual void setFireInterval (double interval)
 
virtual void setWeaponFrame (const DtCoordinateFrame &frame)
 
virtual const DtCoordinateFrame & weaponFrame () const
 

Protected Member Functions

virtual void fireBullet (const dvec3 &origin, const dvec3 &direction)
 
virtual bool canFire () const
 

Protected Attributes

DtFiringMode myCurrentMode
 
double myFireInterval
 
int myBurstCount
 
int myBurstRoundsFired
 
double myTimeSinceLastShot
 
bool myIsFiring
 
dvec3 myFiringOrigin
 
dvec3 myFiringDirection
 
DtAccuracyModel myAccuracy
 
const DtBulletDefinition * myBulletDef
 
FireCallback myFireCallback
 
DtCoordinateFrame myWeaponFrame
 

Member Typedef Documentation

using makVrv::DtFiringSystem::FireCallback = std::function<void(const dvec3&, const dvec3&)>

Callback type invoked with the world-space origin and direction each time a round is fired.

Constructor & Destructor Documentation

makVrv::DtFiringSystem::DtFiringSystem ( )

Default constructor.

virtual makVrv::DtFiringSystem::~DtFiringSystem ( )
virtual

Destructor.

Member Function Documentation

virtual void makVrv::DtFiringSystem::setFiringMode ( DtFiringMode  mode)
virtual

Sets the firing mode.

virtual DtFiringMode makVrv::DtFiringSystem::firingMode ( ) const
virtual

Returns the current firing mode.

virtual void makVrv::DtFiringSystem::setFireRate ( double  roundsPerMinute)
virtual

Sets the fire rate in rounds per minute.

virtual double makVrv::DtFiringSystem::fireRate ( ) const
virtual

Returns the fire rate in rounds per minute.

virtual void makVrv::DtFiringSystem::setBurstCount ( int  rounds)
virtual

Sets the number of rounds per burst; clamped to a minimum of 1.

virtual int makVrv::DtFiringSystem::burstCount ( ) const
virtual

Returns the number of rounds per burst.

virtual void makVrv::DtFiringSystem::setBulletDefinition ( const DtBulletDefinition &  bullet)
virtual

Sets the bullet definition describing projectile properties.

The bullet definition is associated with the ownship entity firing this system. It defines physical characteristics (mass, caliber, muzzle velocity) that are specific to the weapon being simulated for that entity.

virtual const DtBulletDefinition* makVrv::DtFiringSystem::bulletDefinition ( ) const
virtual

Returns the bullet definition, or null if not set.

virtual void makVrv::DtFiringSystem::startFiring ( const dvec3 &  origin,
const dvec3 &  direction 
)
virtual

Starts firing from the given origin in the given direction.

In Single mode, one round is fired immediately and firing stops. In Burst mode, the first round fires immediately and remaining fire on subsequent update() calls. In Automatic mode, the first round fires immediately and additional rounds fire on each subsequent update() call until stopFiring() is called. The direction vector is normalised internally before use.

virtual void makVrv::DtFiringSystem::stopFiring ( )
virtual

Stops firing.

virtual void makVrv::DtFiringSystem::update ( double  deltaTime)
virtual

Advances the firing system by one frame.

Parameters
deltaTimeElapsed time in seconds.
virtual DtAccuracyModel& makVrv::DtFiringSystem::accuracyModel ( )
virtual

Returns the accuracy model for this firing system.

virtual const DtAccuracyModel& makVrv::DtFiringSystem::accuracyModel ( ) const
virtual

Returns the accuracy model for this firing system (const).

virtual void makVrv::DtFiringSystem::registerFireCallback ( FireCallback  callback)
virtual

Registers a callback invoked each time a round is fired.

virtual bool makVrv::DtFiringSystem::isFiring ( ) const
virtual

Returns whether the weapon is currently firing.

virtual double makVrv::DtFiringSystem::timeSinceLastShot ( ) const
virtual

Returns the elapsed time since the last shot in seconds.

virtual int makVrv::DtFiringSystem::burstRoundsFired ( ) const
virtual

Returns the number of rounds fired in the current burst.

virtual const dvec3& makVrv::DtFiringSystem::firingOrigin ( ) const
virtual

Returns the current firing origin in world space.

virtual const dvec3& makVrv::DtFiringSystem::firingDirection ( ) const
virtual

Returns the current firing direction.

virtual void makVrv::DtFiringSystem::setTimeSinceLastShot ( double  time)
virtual

Sets the elapsed time since the last shot.

virtual void makVrv::DtFiringSystem::setBurstRoundsFired ( int  count)
virtual

Sets the number of rounds fired in the current burst.

virtual void makVrv::DtFiringSystem::setFiringOrigin ( const dvec3 &  origin)
virtual

Sets the current firing origin.

virtual void makVrv::DtFiringSystem::setFiringDirection ( const dvec3 &  direction)
virtual

Sets the current firing direction.

Parameters
directionThe desired firing direction.
virtual void makVrv::DtFiringSystem::setIsFiring ( bool  firing)
virtual

Sets whether the weapon is firing.

virtual void makVrv::DtFiringSystem::setFireInterval ( double  interval)
virtual

Sets the interval between shots in seconds.

virtual void makVrv::DtFiringSystem::setWeaponFrame ( const DtCoordinateFrame &  frame)
virtual

Sets the weapon's coordinate frame.

Parameters
frameCoordinate frame representing weapon orientation.
virtual const DtCoordinateFrame& makVrv::DtFiringSystem::weaponFrame ( ) const
virtual

Returns the weapon's coordinate frame.

virtual void makVrv::DtFiringSystem::fireBullet ( const dvec3 &  origin,
const dvec3 &  direction 
)
protectedvirtual

Fires a single bullet from the given origin in the given direction.

virtual bool makVrv::DtFiringSystem::canFire ( ) const
protectedvirtual

Returns whether the weapon is able to fire right now.

Member Data Documentation

DtFiringMode makVrv::DtFiringSystem::myCurrentMode
protected

Current firing mode.

double makVrv::DtFiringSystem::myFireInterval
protected

Seconds between consecutive shots.

int makVrv::DtFiringSystem::myBurstCount
protected

Rounds per burst.

int makVrv::DtFiringSystem::myBurstRoundsFired
protected

Rounds fired in the current burst.

double makVrv::DtFiringSystem::myTimeSinceLastShot
protected

Seconds elapsed since the last shot.

bool makVrv::DtFiringSystem::myIsFiring
protected

Whether the weapon is currently firing.

dvec3 makVrv::DtFiringSystem::myFiringOrigin
protected

Current firing origin in world space.

dvec3 makVrv::DtFiringSystem::myFiringDirection
protected

Current firing direction.

DtAccuracyModel makVrv::DtFiringSystem::myAccuracy
protected

Accuracy model for this weapon.

const DtBulletDefinition* makVrv::DtFiringSystem::myBulletDef
protected

Bullet definition; not owned.

FireCallback makVrv::DtFiringSystem::myFireCallback
protected

Callback invoked on each round fired.

DtCoordinateFrame makVrv::DtFiringSystem::myWeaponFrame
protected

Weapon orientation frame.


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

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)