Skip to content

Instantly share code, notes, and snippets.

@pppoe252110
pppoe252110 / WeaponSway.cs
Last active September 28, 2025 19:36
Correct Weapon Sway implementation which does not depend on fps
using UnityEngine;
public class WeaponSway : MonoBehaviour
{
[SerializeField] private Transform weaponTransform;
[Header("Sway Properties")]
[SerializeField] private float swaySmooth = 8f;
[SerializeField] private float swayDamp = 2f;
[SerializeField] private float posToRotAmount = 1f;