DemoGun #
Mode #
- Use Ballistics: On = ballistic arc; Off = straight (hitscan) ray of comparable range.
Aiming #
- Use Camera: Aim at screen center using the assigned Camera.
- Face Screen Center: Rotates the gun to the aim direction each shot/update.
- Camera: Optional; defaults to Camera.main.
- Aim Max Distance: Fallback distance for the screen-center ray when nothing is hit.
Ballistics #
- Firepoint: Muzzle transform; shot starts here and uses its forward.
- Fire Rate: Seconds between shots when holding Fire1.
- Muzzle Velocity: Initial speed for ballistic flight and timing for straight rays.
- Gravity: Gravity vector applied to the ballistic arc
- Max Time: Max simulated time-of-flight. Also used as a fallback duration.
- Time Step: Simulation step size; smaller is more precise, larger is faster.
Collision #
- Layers: Physics layers to test.
- Query Trigger Interaction: Include, Ignore, or Collide with triggers.
- Self Root: Root transform to ignore (prevents hitting your own weapon/rig).
Tracer #
- Tracer: Tracer scene instance or prefab.
- Tracer Width: LineRenderer width.
- Tracer Default Length: On miss, straight tail length for visibility.
- Tracer Trail Duration: Duration of the visible “tail” following the head
TIP (<= 0 leaves Tracer defaults).
Pooling (used when Tracer is a prefab) #
- Auto Pool Tracers: Enable simple built-in pooling.
- Pool Warmup: Instances precreated on first use.
- Pool Max Size: Capacity of the pool.
- Pool Can Grow: Allow extra instantiation past capacity during bursts.
- Pool Parent: Optional parent for pooled objects.
- Pool Return Padding: Extra seconds after a tracer’s animation to return it.
Tracer #
Lifetime #
- Visible Time: Default visibility if no duration provided.
- Destroy: If true, the tracer GameObject is destroyed at end; otherwise it is cleared for reuse.
Trailing #
- Trail Enabled: Show only a short trailing segment that follows the head.
- Trail Duration: Duration (seconds) of the visible tail segment.
- Stop At Impact: End immediately when head reaches impact, avoiding any “through-surface” look.
- Impact Hold: Optional small hold before clearing at impact.
Rendering #
- Force World Space: Ensure LineRenderer uses world space (recommended).
- End Skin: Retract head slightly from the final hit point to avoid visual penetration.
- Corner/Cap Vertices, Alignment: Standard LineRenderer styling.
