diff options
Diffstat (limited to 'DragHandler.cs')
-rw-r--r-- | DragHandler.cs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/DragHandler.cs b/DragHandler.cs new file mode 100644 index 0000000..adb8df4 --- /dev/null +++ b/DragHandler.cs @@ -0,0 +1,25 @@ +using UnityEngine; + +public class DragHandler : MonoBehaviour +{ + private float drag; + + private float angularDrag; + + private Rigidbody rig; + + public float dragAmount = 1f; + + private void Start() + { + rig = GetComponent<Rigidbody>(); + drag = rig.drag; + angularDrag = rig.angularDrag; + } + + private void Update() + { + rig.drag = drag * dragAmount; + rig.angularDrag = angularDrag * dragAmount; + } +} |