diff --git a/Runtime/Extensions/TransformExtensions.cs b/Runtime/Extensions/TransformExtensions.cs
index dcac760..348589d 100644
--- a/Runtime/Extensions/TransformExtensions.cs
+++ b/Runtime/Extensions/TransformExtensions.cs
@@ -15,5 +15,104 @@ public static void DestroyChildren(this Transform transform)
Object.Destroy(child.gameObject);
}
}
+
+ ///
+ /// Return a Vector3, the direction from source to destination
+ ///
+ ///
+ ///
+ ///
+ public static Vector3 DirectionTo(this Transform source, Vector3 destination)
+ {
+ return source.position.DirectionTo(destination);
+ }
+
+ ///
+ /// Return a normalized Vector3, the direction from source to destination
+ ///
+ ///
+ ///
+ ///
+ public static Vector3 NormalDirectionTo(this Transform source, Vector3 destination)
+ {
+ return source.position.NormalDirectionTo(destination);
+ }
+
+ ///
+ /// Return a Vector3, the direction from source to destination
+ ///
+ ///
+ ///
+ ///
+ public static Vector3 DirectionTo(this Transform source, Transform destination)
+ {
+ return source.DirectionTo(destination.position);
+ }
+
+ ///
+ /// Return a normalized Vector3, the direction from source to destination
+ ///
+ ///
+ ///
+ ///
+ public static Vector3 NormalDirectionTo(this Transform source, Transform destination)
+ {
+ return source.NormalDirectionTo(destination.position);
+ }
+
+ ///
+ /// Return a Vector3, the direction from source to destination
+ ///
+ ///
+ ///
+ ///
+ public static Vector3 DirectionTo(this Transform source, GameObject destination)
+ {
+ return source.DirectionTo(destination.transform.position);
+ }
+
+ ///
+ /// Return a normalized Vector3, the direction from source to destination
+ ///
+ ///
+ ///
+ ///
+ public static Vector3 NormalDirectionTo(this Transform source, GameObject destination)
+ {
+ return source.NormalDirectionTo(destination.transform.position);
+ }
+
+ ///
+ /// Return a float. the distance between to points
+ ///
+ ///
+ ///
+ ///
+ public static float DistanceTo(this Transform source, Vector3 destination)
+ {
+ return source.position.DistanceTo(destination);
+ }
+
+ ///
+ /// Return a float. the distance between to points
+ ///
+ ///
+ ///
+ ///
+ public static float DistanceTo(this Transform source, Transform destination)
+ {
+ return source.position.DistanceTo(destination.position);
+ }
+
+ ///
+ /// Return a float. the distance between to points
+ ///
+ ///
+ ///
+ ///
+ public static float DistanceTo(this Transform source, GameObject destination)
+ {
+ return source.DistanceTo(destination.transform);
+ }
}
}
diff --git a/Runtime/Extensions/Vector2Extensions.cs b/Runtime/Extensions/Vector2Extensions.cs
new file mode 100644
index 0000000..d3cb8f3
--- /dev/null
+++ b/Runtime/Extensions/Vector2Extensions.cs
@@ -0,0 +1,120 @@
+using UnityEngine;
+
+namespace DapperDino.DapperTools.Extensions
+{
+ public static class Vector2Extensions
+ {
+ ///
+ /// Return a copy of this vector with an altered x and/or y component
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static Vector2 With(this Vector2 original, float? x = null, float? y = null)
+ {
+ return new Vector2(x ?? original.x, y ?? original.y);
+ }
+
+ ///
+ /// Return a Vector2, the direction from source to destination
+ ///
+ ///
+ ///
+ ///
+ public static Vector2 DirectionTo(this Vector2 source, Vector2 destination)
+ {
+ Debug.LogWarning("Change function call DirectionTo");
+ return destination - source;
+ }
+
+ ///
+ /// Return a normalized Vector2, the direction from source to destination
+ ///
+ ///
+ ///
+ ///
+ public static Vector2 NormalDirectionTo(this Vector2 source, Vector2 destination)
+ {
+ Vector2 dir = destination - source;
+ return dir.normalized;
+ }
+
+ ///
+ /// Return a Vector2, the direction from source to destination
+ ///
+ ///
+ ///
+ ///
+ public static Vector2 DirectionTo(this Vector2 source, Transform destination)
+ {
+ return source.DirectionTo(destination.position);
+ }
+
+ ///
+ /// Return a normalized Vector2, the direction from source to destination
+ ///
+ ///
+ ///
+ ///
+ public static Vector2 NormalDirectionTo(this Vector2 source, Transform destination)
+ {
+ return source.NormalDirectionTo(destination.position);
+ }
+
+ ///
+ /// Return a Vector2, the direction from source to destination
+ ///
+ ///
+ ///
+ ///
+ public static Vector2 DirectionTo(this Vector2 source, GameObject destination)
+ {
+ return source.DirectionTo(destination.transform);
+ }
+
+ ///
+ /// Return a normalized Vector2, the direction from source to destination
+ ///
+ ///
+ ///
+ ///
+ public static Vector2 NormalDirectionTo(this Vector2 source, GameObject destination)
+ {
+ return source.NormalDirectionTo(destination.transform);
+ }
+
+ ///
+ /// Return a float. the distance between to points
+ ///
+ ///
+ ///
+ ///
+ public static float DistanceTo(this Vector2 source, Vector2 destination)
+ {
+ return Vector2.Distance(destination, source);
+ }
+
+ ///
+ /// Return a float. the distance between to points
+ ///
+ ///
+ ///
+ ///
+ public static float DistanceTo(this Vector2 source, Transform destination)
+ {
+ return Vector2.Distance(destination.position, source);
+ }
+
+ ///
+ /// Return a float. the distance between to points
+ ///
+ ///
+ ///
+ ///
+ public static float DistanceTo(this Vector2 source, GameObject destination)
+ {
+ return Vector2.Distance(destination.transform.position, source);
+ }
+ }
+}
diff --git a/Runtime/Extensions/Vector2Extensions.cs.meta b/Runtime/Extensions/Vector2Extensions.cs.meta
new file mode 100644
index 0000000..0bb4bd9
--- /dev/null
+++ b/Runtime/Extensions/Vector2Extensions.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: dec99574756d5b44eb50866170efb8f4
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Runtime/Extensions/Vector3Extensions.cs b/Runtime/Extensions/Vector3Extensions.cs
new file mode 100644
index 0000000..7ad6d14
--- /dev/null
+++ b/Runtime/Extensions/Vector3Extensions.cs
@@ -0,0 +1,121 @@
+using UnityEngine;
+
+namespace DapperDino.DapperTools.Extensions
+{
+ public static class Vector3Extensions
+ {
+ ///
+ /// Return a copy of this vector with an altered x and/or y and/or z component
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static Vector3 With(this Vector3 original, float? x = null, float? y = null, float? z = null)
+ {
+ return new Vector3(x ?? original.x, y ?? original.y, z ?? original.z);
+ }
+
+ ///
+ /// Return a Vector3, the direction from source to destination
+ ///
+ ///
+ ///
+ ///
+ public static Vector3 DirectionTo(this Vector3 source, Vector3 destination)
+ {
+ Debug.LogWarning("Change function call DirectionTo");
+ return (destination - source);
+ }
+
+ ///
+ /// Return a normalized Vector3, the direction from source to destination
+ ///
+ ///
+ ///
+ ///
+ public static Vector3 NormalDirectionTo(this Vector3 source, Vector3 destination)
+ {
+ return Vector3.Normalize(destination - source);
+ }
+
+ ///
+ /// Return a Vector3, the direction from source to destination
+ ///
+ ///
+ ///
+ ///
+ public static Vector3 DirectionTo(this Vector3 source, Transform destination)
+ {
+ return source.DirectionTo(destination.position);
+ }
+
+
+ ///
+ /// Return a normalized Vector3, the direction from source to destination
+ ///
+ ///
+ ///
+ ///
+ public static Vector3 NormalDirectionTo(this Vector3 source, Transform destination)
+ {
+ return source.NormalDirectionTo(destination.position);
+ }
+
+ ///
+ /// Return a Vector3, the direction from source to destination
+ ///
+ ///
+ ///
+ ///
+ public static Vector3 DirectionTo(this Vector3 source, GameObject destination)
+ {
+ return source.DirectionTo(destination.transform.position);
+ }
+
+ ///
+ /// Return a normalized Vector3, the direction from source to destination
+ ///
+ ///
+ ///
+ ///
+ public static Vector3 NormalDirectionTo(this Vector3 source, GameObject destination)
+ {
+ return source.NormalDirectionTo(destination.transform.position);
+ }
+
+ ///
+ /// Return a float. the distance between to points
+ ///
+ ///
+ ///
+ ///
+ public static float DistanceTo(this Vector3 source, Vector3 destination)
+ {
+ return Vector3.Magnitude(destination - source);
+ }
+
+ ///
+ /// Return a float. the distance between to points
+ ///
+ ///
+ ///
+ ///
+ public static float DistanceTo(this Vector3 source, Transform destination)
+ {
+ return Vector3.Magnitude(destination.position - source);
+ }
+
+ ///
+ /// Return a float. the distance between to points
+ ///
+ ///
+ ///
+ ///
+ public static float DistanceTo(this Vector3 source, GameObject destination)
+ {
+ return Vector3.Magnitude(destination.transform.position - source);
+ }
+ }
+}
diff --git a/Runtime/Extensions/Vector3Extensions.cs.meta b/Runtime/Extensions/Vector3Extensions.cs.meta
new file mode 100644
index 0000000..72dfae6
--- /dev/null
+++ b/Runtime/Extensions/Vector3Extensions.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 8d001d244d46c424abf626ea2fce83d7
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Runtime/Extensions/VectorExtensions.cs b/Runtime/Extensions/VectorExtensions.cs
index 6294fa4..6aeec04 100644
--- a/Runtime/Extensions/VectorExtensions.cs
+++ b/Runtime/Extensions/VectorExtensions.cs
@@ -12,10 +12,10 @@ public static class VectorExtensions
///
///
///
- public static Vector3 With(this Vector3 original, float? x = null, float? y = null, float? z = null)
- {
- return new Vector3(x ?? original.x, y ?? original.y, z ?? original.z);
- }
+ //public static Vector3 With(this Vector3 original, float? x = null, float? y = null, float? z = null)
+ //{
+ // return new Vector3(x ?? original.x, y ?? original.y, z ?? original.z);
+ //}
///
/// Return a copy of this vector with an altered x and/or y component
@@ -24,10 +24,10 @@ public static Vector3 With(this Vector3 original, float? x = null, float? y = nu
///
///
///
- public static Vector2 With(this Vector2 original, float? x = null, float? y = null)
- {
- return new Vector2(x ?? original.x, y ?? original.y);
- }
+ //public static Vector2 With(this Vector2 original, float? x = null, float? y = null)
+ //{
+ // return new Vector2(x ?? original.x, y ?? original.y);
+ //}
///
/// Return this vector with only its x and y components
diff --git a/Tests/Runtime/Extensions/TransformExtensionsTests.cs b/Tests/Runtime/Extensions/TransformExtensionsTests.cs
new file mode 100644
index 0000000..d53994c
--- /dev/null
+++ b/Tests/Runtime/Extensions/TransformExtensionsTests.cs
@@ -0,0 +1,87 @@
+using DapperDino.DapperTools.Extensions;
+using NUnit.Framework;
+using UnityEngine;
+
+namespace DapperDino.DapperTools.Tests.Extensions
+{
+ public class TransformExtensionsTests
+ {
+ [Test]
+ public void TransformDirectionTo_Vector3_Test()
+ {
+
+ var source = new GameObject();
+ source.transform.position = new Vector3(4f,4f,4f);
+ var destination = new Vector3(1f, 1f, 1f);
+
+ var fetch = source.transform.DirectionTo(destination);
+ var correct = (destination - source.transform.position);
+ Assert.AreEqual(correct, fetch);
+ }
+
+ [Test]
+ public void TransformNormalDirectionTo_Vector3_Test()
+ {
+
+ var source = new GameObject();
+ source.transform.position = new Vector3(4f, 4f, 4f);
+ var destination = new Vector3(1f, 1f, 1f);
+
+ var fetch = source.transform.NormalDirectionTo(destination);
+ var correct = (destination - source.transform.position).normalized;
+ Assert.AreEqual(correct, fetch);
+ }
+
+ [Test]
+ public void TransformDirectionTo_Transform_Test()
+ {
+ var source = new GameObject();
+ source.transform.position = new Vector3(4f, 4f, 4f);
+ var destination = new GameObject();
+ destination.transform.position = new Vector3(1f, 1f, 1f);
+
+ var fetch = source.transform.DirectionTo(destination.transform);
+ var correct = (destination.transform.position - source.transform.position);
+ Assert.AreEqual(correct, fetch);
+ }
+
+ [Test]
+ public void TransformNormalDirectionTo_Transform_Test()
+ {
+ var source = new GameObject();
+ source.transform.position = new Vector3(4f, 4f, 4f);
+ var destination = new GameObject();
+ destination.transform.position = new Vector3(1f, 1f, 1f);
+
+ var fetch = source.transform.NormalDirectionTo(destination.transform);
+ var correct = (destination.transform.position - source.transform.position).normalized;
+ Assert.AreEqual(correct, fetch);
+ }
+
+ [Test]
+ public void TransformDirectionTo_GameObject_Test()
+ {
+ var source = new GameObject();
+ source.transform.position = new Vector3(4f, 4f, 4f);
+ var destination = new GameObject();
+ destination.transform.position = new Vector3(1f, 1f, 1f);
+
+ var fetch = source.transform.DirectionTo(destination);
+ var correct = (destination.transform.position - source.transform.position);
+ Assert.AreEqual(correct, fetch);
+ }
+
+ [Test]
+ public void TransformNormalDirectionTo_GameObject_Test()
+ {
+ var source = new GameObject();
+ source.transform.position = new Vector3(4f, 4f, 4f);
+ var destination = new GameObject();
+ destination.transform.position = new Vector3(1f, 1f, 1f);
+
+ var fetch = source.transform.NormalDirectionTo(destination);
+ var correct = (destination.transform.position - source.transform.position).normalized;
+ Assert.AreEqual(correct, fetch);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Tests/Runtime/Extensions/TransformExtensionsTests.cs.meta b/Tests/Runtime/Extensions/TransformExtensionsTests.cs.meta
new file mode 100644
index 0000000..2172777
--- /dev/null
+++ b/Tests/Runtime/Extensions/TransformExtensionsTests.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 46eb2fa516e2fd343b6ae1b272517669
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Tests/Runtime/Extensions/Vector2ExtensionsTests.cs b/Tests/Runtime/Extensions/Vector2ExtensionsTests.cs
new file mode 100644
index 0000000..2848c05
--- /dev/null
+++ b/Tests/Runtime/Extensions/Vector2ExtensionsTests.cs
@@ -0,0 +1,141 @@
+using DapperDino.DapperTools.Extensions;
+using UnityEngine;
+using NUnit.Framework;
+
+namespace DapperDino.DapperTools.Tests.Extensions
+{
+
+ public class Vector2ExtensionsTests
+ {
+ [Test]
+ public void Vector2DirectionTo_Vector2_Test()
+ {
+ var source = new Vector2(1f, 1f);
+ var destination = new Vector2(4f, 4f);
+ var fetch = source.DirectionTo(destination);
+
+ var correct = (destination - source);
+ Assert.AreEqual(correct, fetch);
+ }
+
+ [Test]
+ public void Vector2NormalDirectionTo_Vector2_Test()
+ {
+ var source = new Vector2(1f, 1f);
+ var destination = new Vector2(4f, 4f);
+ var fetch = source.NormalDirectionTo(destination);
+
+ var correct = (destination - source).normalized;
+ Assert.AreEqual(correct, fetch);
+ }
+
+ [Test]
+ public void Vector2DirectionTo_Transform_Test()
+ {
+ var source = new Vector2(1f, 1f);
+ var destination = new GameObject();
+ destination.transform.position = new Vector3(4f, 4f, 0f);
+
+ var fetch = source.DirectionTo(destination.transform);
+
+ var correct = ((Vector2)destination.transform.position - source);
+ Assert.AreEqual(correct, fetch);
+ }
+
+ [Test]
+ public void Vector2NormalDirectionTo_Transform_Test()
+ {
+ var source = new Vector2(1f, 1f);
+ var destination = new GameObject();
+ var fetch = source.NormalDirectionTo(destination.transform);
+
+ var correct = ((Vector2)destination.transform.position - source).normalized;
+ Assert.AreEqual(correct, fetch);
+ }
+
+ [Test]
+ public void Vector2DirectionTo_GameObject_Test()
+ {
+ var source = new Vector2(1f, 1f);
+ var destination = new GameObject();
+ destination.transform.position = new Vector3(4f, 4f, 0f);
+
+ var fetch = source.DirectionTo(destination);
+
+ var correct = ((Vector2)destination.transform.position - source);
+ Assert.AreEqual(correct, fetch);
+ }
+
+ [Test]
+ public void Vector2NormalDirectionTo_GameObject_Test()
+ {
+ var source = new Vector2(1f, 1f);
+ var destination = new GameObject();
+ destination.transform.position = new Vector3(4f,4f,0f);
+
+ var fetch = source.NormalDirectionTo(destination);
+ var correct = ((Vector2)destination.transform.position - source).normalized;
+
+ Assert.AreEqual(correct, fetch);
+ }
+
+ [Test]
+ public void Vector2DistanceTo_Vector2_Test()
+ {
+ var source = new Vector2(1f, 1f);
+ var destination = new Vector2(4f, 4f);
+
+ var fetch = source.DistanceTo(destination);
+
+ var correct = Vector2.Distance(destination, source);
+
+ Assert.AreEqual(correct, fetch);
+ }
+
+ [Test]
+ public void Vector2DistanceTo_Transfrom_Test()
+ {
+ var source = new Vector2(1f, 1f);
+ var destination = new GameObject();
+ destination.transform.position = new Vector3(4f, 4f, 0f);
+
+ var fetch = source.DistanceTo(destination.transform);
+ var correct = Vector2.Distance(destination.transform.position, source);
+
+ Assert.AreEqual(correct, fetch);
+ }
+
+ [Test]
+ public void Vector2DistanceTo_GameObject_Test()
+ {
+ var source = new Vector2(1f, 1f);
+ var destination = new GameObject();
+ destination.transform.position = new Vector3(4f, 4f, 0f);
+
+ var fetch = source.DistanceTo(destination);
+ var correct = Vector2.Distance(destination.transform.position, source);
+
+ Assert.AreEqual(correct, fetch);
+ }
+
+ [Test]
+ public void Vector2With_XIsChanged()
+ {
+ var vector = new Vector2(1f, 1f);
+
+ var fetch = vector.With(x:2f);
+
+ Assert.AreEqual(new Vector2(2f, 1f), fetch);
+ }
+
+ [Test]
+ public void Vector2With_YIsChanged()
+ {
+ var vector = new Vector2(1f, 1f);
+
+ var fetch = vector.With(y:2f);
+
+ Assert.AreEqual(new Vector2(1f, 2f), fetch);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Tests/Runtime/Extensions/Vector2ExtensionsTests.cs.meta b/Tests/Runtime/Extensions/Vector2ExtensionsTests.cs.meta
new file mode 100644
index 0000000..5ca18d9
--- /dev/null
+++ b/Tests/Runtime/Extensions/Vector2ExtensionsTests.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 2f6111b4fd8b263408e11e7ce5cce9ea
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Tests/Runtime/Extensions/Vector3ExtensionsTests.cs b/Tests/Runtime/Extensions/Vector3ExtensionsTests.cs
new file mode 100644
index 0000000..859b3ec
--- /dev/null
+++ b/Tests/Runtime/Extensions/Vector3ExtensionsTests.cs
@@ -0,0 +1,191 @@
+using DapperDino.DapperTools.Extensions;
+using UnityEngine;
+using NUnit.Framework;
+
+namespace DapperDino.DapperTools.Tests.Extensions
+{
+
+ public class Vector3ExtensionsTests
+ {
+ [Test]
+ public void Vector3With_XIsChanged()
+ {
+ var vector = new Vector3(1f, 1f, 1f);
+
+ var fetch = vector.With(x: 2f);
+
+ Assert.AreEqual(new Vector3(2f, 1f, 1f), fetch);
+ }
+
+ [Test]
+ public void Vector3With_YIsChanged()
+ {
+ var vector = new Vector3(1f, 1f, 1f);
+
+ var fetch = vector.With(y: 2f);
+
+ Assert.AreEqual(new Vector3(1f, 2f, 1f), fetch);
+ }
+
+ [Test]
+ public void Vector3With_ZIsChanged()
+ {
+ var vector = new Vector3(1f, 1f, 1f);
+
+ var fetch = vector.With(z: 2f);
+
+ Assert.AreEqual(new Vector3(1f, 1f, 2f), fetch);
+ }
+
+ [Test]
+ public void Vector3With_YZIsChanged()
+ {
+ var vector = new Vector3(1f, 1f, 1f);
+
+ var fetch = vector.With(y: 2f, z: 2f);
+
+ Assert.AreEqual(new Vector3(1f, 2f, 2f), fetch);
+ }
+
+ [Test]
+ public void Vector3With_XZIsChanged()
+ {
+ var vector = new Vector3(1f, 1f, 1f);
+
+ var fetch = vector.With(x: 2f, z: 2f);
+
+ Assert.AreEqual(new Vector3(2f, 1f, 2f), fetch);
+ }
+
+ [Test]
+ public void Vector3With_XYIsChanged()
+ {
+ var vector = new Vector3(1f, 1f, 1f);
+
+ var fetch = vector.With(x: 2f, y: 2f);
+
+ Assert.AreEqual(new Vector3(2f, 2f, 1f), fetch);
+ }
+
+ [Test]
+ public void Vector3With_XYZIsChanged()
+ {
+ var vector = new Vector3(1f, 1f, 1f);
+
+ var fetch = vector.With(x: 2f, y: 2f, z: 2f);
+
+ Assert.AreEqual(new Vector3(2f, 2f, 2f), fetch);
+ }
+
+ [Test]
+ public void Vector3DirectionTo_Vector3_Vector3_Test()
+ {
+ var source = new Vector3(1f, 1f, 1f);
+ var destination = new Vector3(4f, 4f, 4f);
+ var fetch = source.DirectionTo(destination);
+
+ var correct = (destination - source);
+ Assert.AreEqual(correct, fetch);
+ }
+
+ [Test]
+ public void Vector3NormalDirectionTo_Vector3_Vector3_Test()
+ {
+ var source = new Vector3(1f, 1f, 1f);
+ var destination = new Vector3(4f, 4f, 4f);
+ var fetch = source.NormalDirectionTo(destination);
+
+ var correct = (destination - source).normalized;
+ Assert.AreEqual(correct, fetch);
+ }
+
+ [Test]
+ public void Vector3DirectionTo_Vector3_Transform_Test()
+ {
+ var source = new Vector3(1f, 1f, 1f);
+ var destination = new GameObject();
+ destination.transform.position = new Vector3(4f, 4f, 4f);
+
+ var fetch = source.DirectionTo(destination.transform);
+
+ var correct = (destination.transform.position - source);
+ Assert.AreEqual(correct, fetch);
+ }
+
+ [Test]
+ public void Vector3NormalDirectionTo_Vector3_Transform_Test()
+ {
+ var source = new Vector3(1f, 1f, 1f);
+ var destination = new GameObject();
+ var fetch = source.NormalDirectionTo(destination.transform);
+
+ var correct = (destination.transform.position - source).normalized;
+ Assert.AreEqual(correct, fetch);
+ }
+
+ [Test]
+ public void Vector3DirectionTo_Vector3_GameObject_Test()
+ {
+ var source = new Vector3(1f, 1f, 1f);
+ var destination = new GameObject();
+ destination.transform.position = new Vector3(4f, 4f, 0f);
+
+ var fetch = source.DirectionTo(destination);
+
+ var correct = (destination.transform.position - source);
+ Assert.AreEqual(correct, fetch);
+ }
+
+ [Test]
+ public void Vector3NormalDirectionTo_Vector3_GameObject_Test()
+ {
+ var source = new Vector3(1f, 1f, 1f);
+ var destination = new GameObject();
+ destination.transform.position = new Vector3(4f, 4f, 4f);
+
+ var fetch = source.NormalDirectionTo(destination);
+ var correct = (destination.transform.position - source).normalized;
+
+ Assert.AreEqual(correct, fetch);
+ }
+
+ [Test]
+ public void Vector3DistanceTo_Vector3_Test()
+ {
+ var source = new Vector3(1f, 1f, 1f);
+ var destination = new Vector3(4f, 4f, 4f);
+
+ var fetch = source.DistanceTo(destination);
+
+ var correct = Vector3.Distance(destination, source);
+
+ Assert.AreEqual(correct, fetch);
+ }
+
+ [Test]
+ public void Vector3DistanceTo_Transfrom_Test()
+ {
+ var source = new Vector3(1f, 1f, 1f);
+ var destination = new GameObject();
+ destination.transform.position = new Vector3(4f, 4f, 4f);
+
+ var fetch = source.DistanceTo(destination.transform);
+ var correct = Vector3.Distance(destination.transform.position, source);
+
+ Assert.AreEqual(correct, fetch);
+ }
+
+ [Test]
+ public void Vector3DistanceTo_GameObject_Test()
+ {
+ var source = new Vector3(1f, 1f, 1f);
+ var destination = new GameObject();
+ destination.transform.position = new Vector3(4f, 4f, 4f);
+
+ var fetch = source.DistanceTo(destination);
+ var correct = Vector3.Distance(destination.transform.position, source);
+
+ Assert.AreEqual(correct, fetch);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Tests/Runtime/Extensions/Vector3ExtensionsTests.cs.meta b/Tests/Runtime/Extensions/Vector3ExtensionsTests.cs.meta
new file mode 100644
index 0000000..daf7ca7
--- /dev/null
+++ b/Tests/Runtime/Extensions/Vector3ExtensionsTests.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 133962d5e51f63d419573ec98d2fdc2e
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant: