![]() |
VR-Forces Developer's Guide
|
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 |
| 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.
| makVrv::DtFiringSystem::DtFiringSystem | ( | ) |
Default constructor.
|
virtual |
Destructor.
|
virtual |
Sets the firing mode.
|
virtual |
Returns the current firing mode.
|
virtual |
Sets the fire rate in rounds per minute.
|
virtual |
Returns the fire rate in rounds per minute.
|
virtual |
Sets the number of rounds per burst; clamped to a minimum of 1.
|
virtual |
Returns the number of rounds per burst.
|
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 |
Returns the bullet definition, or null if not set.
|
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 |
Stops firing.
|
virtual |
Advances the firing system by one frame.
| deltaTime | Elapsed time in seconds. |
|
virtual |
Returns the accuracy model for this firing system.
|
virtual |
Returns the accuracy model for this firing system (const).
|
virtual |
Registers a callback invoked each time a round is fired.
|
virtual |
Returns whether the weapon is currently firing.
|
virtual |
Returns the elapsed time since the last shot in seconds.
|
virtual |
Returns the number of rounds fired in the current burst.
|
virtual |
Returns the current firing origin in world space.
|
virtual |
Returns the current firing direction.
|
virtual |
Sets the elapsed time since the last shot.
|
virtual |
Sets the number of rounds fired in the current burst.
|
virtual |
Sets the current firing origin.
|
virtual |
Sets the current firing direction.
| direction | The desired firing direction. |
|
virtual |
Sets whether the weapon is firing.
|
virtual |
Sets the interval between shots in seconds.
|
virtual |
Sets the weapon's coordinate frame.
| frame | Coordinate frame representing weapon orientation. |
|
virtual |
Returns the weapon's coordinate frame.
|
protectedvirtual |
Fires a single bullet from the given origin in the given direction.
|
protectedvirtual |
Returns whether the weapon is able to fire right now.
|
protected |
Current firing mode.
|
protected |
Seconds between consecutive shots.
|
protected |
Rounds per burst.
|
protected |
Rounds fired in the current burst.
|
protected |
Seconds elapsed since the last shot.
|
protected |
Whether the weapon is currently firing.
|
protected |
Current firing origin in world space.
|
protected |
Current firing direction.
|
protected |
Accuracy model for this weapon.
|
protected |
Bullet definition; not owned.
|
protected |
Callback invoked on each round fired.
|
protected |
Weapon orientation frame.