FPS Weapon Mechanics Prototype
Procedural recoil physics, dynamic spread bloom, and modular ScriptableObject firearm systems in Unity 3D
// Weapon Systems & Visual Demonstration

Project Overview
The FPS Weapon Mechanics Prototype is a technical demonstration built in Unity 3D and C# focused on creating responsive, tactile first-person shooter gunplay without relying on static pre-baked animation clips.
The architecture emphasizes procedural physics, decoupled configuration assets, and multi-variable ballistic dispersion formulas.
Core Gunplay Systems
| System | Component | Technical Implementation |
|---|---|---|
| Procedural Recoil | Spring-Damper Physics | Second-order rotational and translational kickback curves with dynamic return damping |
| Dynamic Spread Bloom | Ballistics Calculator | Multi-variable dispersion cone affected by movement velocity, player stance, and continuous fire |
| Modular Weapon Pipeline | ScriptableObject Assets | Data-driven firearm definitions (fire rate, muzzle velocity, damage, recoil impulse, reload times) |
| Ballistics & Hitscan | Hybrid Raycast Engine | High-velocity raycast projection with bullet drop calculation and penetration testing |
| Weapon Sway & Rigging | Procedural IK Rigging | Mouse delta smoothing and procedural breathing sway applied to weapon viewmodel bones |
Technical Implementation Details
1. Procedural spring-damper recoil physics
Rather than blending static keyframed animations, the weapon controller computes positional and rotational displacement using second-order spring physics equations:
// Procedural recoil calculation
currentRecoilRotation = Vector3.Lerp(currentRecoilRotation, targetRecoilRotation, recoilSnappiness * Time.deltaTime);
targetRecoilRotation = Vector3.Lerp(targetRecoilRotation, Vector3.zero, recoilReturnSpeed * Time.deltaTime);
transform.localRotation = Quaternion.Euler(currentRecoilRotation);
When a shot is fired, the controller applies an instantaneous rotational kickback impulse along the X and Y axes. A damping spring smoothly restores the weapon toward its resting point. If the player fires continuously, impulses accumulate, creating organic recoil climb.
2. Multi-variable dynamic spread cone
Bullet dispersion expands dynamically using a multi-factor formula:
- Base Spread: Inherent mechanical accuracy defined per firearm.
- Movement Multiplier: Player velocity expands the dispersion cone during sprinting or strafing.
- Stance Multiplier: Crouching reduces spread by 35%; jumping expands the cone by 200%.
- Sustained Fire Bloom: Increments cone radius on each successive shot, decaying back to zero after fire stops.
- Aim Down Sights (ADS): Tightens spread cones and slows camera sensitivity for precision aiming.
3. Modular ScriptableObject architecture
All weapon properties (fire rates, bullet speeds, recoil profiles, magazine sizes, audio clips, and muzzle VFX) are encapsulated inside immutable GunData ScriptableObject assets. Designing a new weapon or adjusting game balance requires creating an asset file without modifying codebase scripts.