21 · Combat · 2D and 3D

Projectile aiming and spread

Aim where the target will be, not where it is.

Bullets take time to arrive, so shooting at a moving target misses behind it. Leading the target means solving for where it will be when the shot gets there. Spread is the opposite tool: a random angle inside a cone that makes guns feel loose or tight, and it should be shaped, not pure noise.

Space fireL lead on/off123 spreadTap the scene to fire

Try this: Fire at the moving slime with lead off: shots land behind it. Turn lead on (L), then try wider spread.

Hits 0Misses 0

Fire at the slime.

Prompt bit

Works for 2D or 3D in any engine (Unity, Unreal, Godot, web). Paste the short one for a quick fix, or the detailed one when you want it done properly.

Aim projectiles with target leading: solve for the intercept time when a shot at constant speed meets the target's current velocity (usually under 1 s), aim at that point, add spread inside a cone, and fall back to direct aim when no solution exists.

44 words · one sentence to paste as is

Where it's used

Common mistakes

Aiming at the current position so every shot trails behind, perfect lead that is impossible to dodge, uniform random spread that feels noisy, and ignoring the no-solution case so turrets aim at NaN.

Writing this with an AI assistant? See our best AI coding assistants for game developers.

Missing a concept? Request one.

Related concepts

New concepts, in your inbox.

One short email when we add new concepts, plus our weekly roundup of AI tools for game devs. Unsubscribe any time.