Sniper and Ballistics System
Configure the central scene instance and its optional visuals.
Create an empty Sniper and Ballistics GameObject and add SniperAndBallisticsSystem. Use one instance per scene. Alternatively, start from SAMPLES/Prefabs/Sniper and Ballistics System.prefab, which includes pools and hit listeners.
General settings
- Assign the environment asset to Environment Properties.
- Set Ray Mask to include the layers you want bullets to hit. For the empty tutorial scene, Everything is sufficient. The legacy player can exclude its own layer; per-shot requests can ignore a supplied Shooter's hierarchy independently.
- Assign the Main Camera to Fire Transform. Rays originate at its position and follow its forward direction. Muzzle flashes and the bullet-time starting point have separate transforms. The per-shot API supplies its own origin and direction and does not require FireTransform.
- Configure Zero Distances, starting with
0, then for example100,200,300and500. Keep them non-negative and increasing.
The Inspector ensures the list is nonempty and caps entries after the first at 2000. Despite an old tooltip, it does not force the first value to zero: set it yourself. Zero distances are world distances in metres; changing an asset's display units does not rescale this list.
Tracers
Enable Tracers and assign your Tracer Pooler. Chance runs from 0 to 1. Enable After delays visibility by simulated travel time, which keeps tracers from appearing too close to the camera. Disable tracers if you have not configured a pool.
Debugging
Enable Draw Debug Ray and Draw Hit Rays to see trajectories and surface-hit normals in Scene view. Duration controls how long those rays remain visible.
For a trajectory visible in the game, pool Objects/Trajectory Renderer/Bullet Trajectory Renderer.prefab, enable In Game Debug, and assign Trajectory Renderer Pooler. Disable After controls its persistence after the shot ends.
Leave bullet time disabled until Bullet time effects. With references assigned, continue to Firing a bullet.
