summaryrefslogtreecommitdiff
path: root/DragHandler.cs
diff options
context:
space:
mode:
authorchai <215380520@qq.com>2024-03-13 11:00:58 +0800
committerchai <215380520@qq.com>2024-03-13 11:00:58 +0800
commit6ce8b9e22fc13be34b442c7b6af48b42cd44275a (patch)
treeb38119d2acf0a982cb67e381f146924b9bfc3b3f /DragHandler.cs
+init
Diffstat (limited to 'DragHandler.cs')
-rw-r--r--DragHandler.cs25
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;
+ }
+}