Developer knowledge network · moderated exchange

Сообщество UnreliableCode

Сообщество разработчиков, обратного проектирования и кодирования

Analysis

Weapon sway and aimcone dispersion calculation in Unity engine

raycast_ryan
Ballistics Dev
MEMBER
Представитель: 72
Дата присоединения: Sep 2019
Сообщения: 32
Спасибо: 16
1 месяцев назад · Jul 13, 2026 4:26 AM
#1

How Rust calculates bullet spread angle:

In BaseProjectile:

  • aimCone (float): Base weapon spread angle in degrees.
  • aimConePenalty (float): Accumulated spread while firing.
  • stancePenalty (float): Standing multiplier (typically 1.5x).

The game calculates final firing direction by taking camera forward vector and applying a randomized polar angle offset within aimCone radius.

Reading aimCone values in real-time allows drawing an accurate dynamic spread circle on your HUD!

recoil_god
Member
MEMBER
Представитель: 35
Дата присоединения: Apr 2019
Сообщения: 13
Спасибо: 47
1 месяцев назад · Jul 13, 2026 8:24 AM
#2

Dynamic spread circle in ImGui expands when you move and contracts when you crouch. Gives perfect visual feedback on shot accuracy.

ptr_arithmetic
C++ Wizard
MEMBER
Представитель: 162
Дата присоединения: May 2018
Сообщения: 73
Спасибо: 42
1 месяцев назад · Jul 13, 2026 12:31 PM
#3

Great explanation of Unity weapon spread math.