SniperAndBallisticsSystem
Firing, zero distances, runtime settings and static events.
Source: src/System/SniperAndBallisticsSystem.cs. Access the configured scene instance through SniperAndBallisticsSystem.instance (read-only, inherited from Singleton<T>).
Methods
void ActivateBullet(BulletProperties properties)
void FireBallisticsBullet(BulletProperties properties,
Transform bulletTimeTransform = null, Transform bulletTimeBullet = null)
long FireBallisticsBullet(BulletProperties properties,
BulletShotParameters parameters)
void CycleZeroDistanceUp()
void CycleZeroDistanceDown()ActivateBullet calculates trajectory information for the scene's zero distances, marks the asset ready, then invokes EBulletActivated(properties). Each call raises the event after preparation, including repeated calls for the same asset. Call it before firing each bullet type, after the scene system has initialized.
The legacy void overload captures the configured Fire Transform, current zero distance and system mask. It retains its optional cinematic transforms and existing caller signature. Its hits now have shot IDs, with a null shooter.
The per-shot overload accepts BulletShotParameters and returns a positive long ID for an accepted shot, or 0 if rejected. It works without FireTransform. It validates the bullet's activation, finite origin/nonzero finite direction, and a non-negative prepared zero distance. Position, normalized direction, zeroing angle, mask and ownership settings are captured for that shot. See Multiple shooters.
Both overloads reject new shots during an active global bullet-time sequence. Per-shot requests default to AllowBulletTime false; the legacy overload retains the system's cinematic behavior when a visual bullet is supplied. BulletTimeOrigin is cosmetic and defaults to the simulation origin when omitted. Events may occur during the call, so use the ID on their payload rather than assuming the call has returned.
Zero-distance changes are bounded at either end, not wrapped. EZeroDistanceChanged fires only when the selection changes.
Properties and fields
| Member | Type / access | Meaning |
|---|---|---|
CurrentZeroDistance | float, read | Selected zero distance in world metres. |
BulletTimeRunning | bool, read | Whether a sequence is running. |
GlobalEnvironmentProperties | EnvironmentProperties, read | The runtime clone; its public metric fields are writable. |
FireTransform | Transform, read/write | Ray origin and direction for legacy calls; the per-shot overload supplies its own. |
UseInGameTrajectory | bool, read/write | Enable trajectory LineRenderer output; requires a pool. |
UseTracers | bool, read/write | Enable pooled tracers. |
UseBulletTime | bool, read/write | Enable the bullet-time eligibility check. |
BulletTimeChance | float, read/write | Probability in the 0–1 range; setters do not clamp. |
BulletTimeVirtualTimescale | float, read/write | Multiplier for cinematic bullet playback. |
BulletTimeWaitBeforeResettingTimescale | float, read/write | Wait after path playback, before actual time resets. |
BulletTimeWaitBeforeEnding | float, read/write | Additional wait before sequence end. |
BulletTimeSkipPoint | bool, read/write | Skip playback points immediately while true. |
MeasurementUnits is the nested enum Imperial, Metric. Asset display choices do not change the metric runtime APIs.
Static events
| Events | Delegate / parameters |
|---|---|
EPenetrationInHit, EPenetrationOutHit, ERicochetHit, ENormalHit, EAnyHit | BulletHitEvent(BulletPoint bulletPoint) |
EBulletTimeStarted | BulletTimeStartEvent(Transform bullet, Transform hitTarget, ref List<BulletPoint> bulletPath, float totalDistance) |
EBulletTimeUpdated | BulletTimeUpdateEvent(float distanceTravelled, float totalDistance) |
EBulletTimePathFinished, EBulletTimeEnded | BulletTimeEndEvent() |
EZeroDistanceChanged | ZeroDistanceEvent() |
EBulletActivated | BulletPropertiesEvent(BulletProperties properties) — raised after ActivateBullet finishes preparation. |
Subscribe before calling ActivateBullet if you need its notification. The event is synchronous and does not replay earlier activations. Subscribe and unsubscribe in matching component lifecycle methods. Hit events are global; BulletPoint describes their payload.