Developer knowledge network · moderated exchange

UnreliableCode қауымдастығы

Әзірлеушілерді зерттеу, кері инженерия және кодтау қауымдастығы

Knowledge indexТірі
4Categories
919Threads
2.8KЖазбалар
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.