summaryrefslogtreecommitdiff
path: root/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Vector3/ClampMagnitude.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Client/Assets/Behavior Designer/Runtime/Basic Tasks/Vector3/ClampMagnitude.cs')
-rw-r--r--Client/Assets/Behavior Designer/Runtime/Basic Tasks/Vector3/ClampMagnitude.cs29
1 files changed, 29 insertions, 0 deletions
diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Vector3/ClampMagnitude.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Vector3/ClampMagnitude.cs
new file mode 100644
index 00000000..c2a7c261
--- /dev/null
+++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/Vector3/ClampMagnitude.cs
@@ -0,0 +1,29 @@
+using UnityEngine;
+
+namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityVector3
+{
+ [TaskCategory("Basic/Vector3")]
+ [TaskDescription("Clamps the magnitude of the Vector3.")]
+ public class ClampMagnitude : Action
+ {
+ [Tooltip("The Vector3 to clamp the magnitude of")]
+ public SharedVector3 vector3Variable;
+ [Tooltip("The max length of the magnitude")]
+ public SharedFloat maxLength;
+ [Tooltip("The clamp magnitude resut")]
+ [RequiredField]
+ public SharedVector3 storeResult;
+
+ public override TaskStatus OnUpdate()
+ {
+ storeResult.Value = Vector3.ClampMagnitude(vector3Variable.Value, maxLength.Value);
+ return TaskStatus.Success;
+ }
+
+ public override void OnReset()
+ {
+ vector3Variable = storeResult = Vector3.zero;
+ maxLength = 0;
+ }
+ }
+} \ No newline at end of file