Developer knowledge network · moderated exchange

UnreliableCode Topluluğu

Geliştirici Araştırması, Tersine Mühendislik ve Kodlama Topluluğu

Knowledge indexCanlı
4Categories
919Threads
2.8KGönderiler
Analysis

Weapon sway and aimcone dispersion calculation in Unity engine

raycast_ryan
Ballistics Dev
MEMBER
Temsilci: 72
Katılım Tarihi: Sep 2019
Gönderiler: 32
Teşekkürler: 16
1 ay önce · 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
Temsilci: 35
Katılım Tarihi: Apr 2019
Gönderiler: 13
Teşekkürler: 47
1 ay önce · 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
Temsilci: 162
Katılım Tarihi: May 2018
Gönderiler: 73
Teşekkürler: 42
1 ay önce · Jul 13, 2026 12:31 PM
#3

Great explanation of Unity weapon spread math.