diff --git a/Assets/Scenes/RopeTest.unity b/Assets/Scenes/RopeTest.unity
new file mode 100644
index 0000000..8a451de
--- /dev/null
+++ b/Assets/Scenes/RopeTest.unity
@@ -0,0 +1,271 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!29 &1
+OcclusionCullingSettings:
+ m_ObjectHideFlags: 0
+ serializedVersion: 2
+ m_OcclusionBakeSettings:
+ smallestOccluder: 5
+ smallestHole: 0.25
+ backfaceThreshold: 100
+ m_SceneGUID: 00000000000000000000000000000000
+ m_OcclusionCullingData: {fileID: 0}
+--- !u!104 &2
+RenderSettings:
+ m_ObjectHideFlags: 0
+ serializedVersion: 9
+ m_Fog: 0
+ m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
+ m_FogMode: 3
+ m_FogDensity: 0.01
+ m_LinearFogStart: 0
+ m_LinearFogEnd: 300
+ m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
+ m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
+ m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
+ m_AmbientIntensity: 1
+ m_AmbientMode: 3
+ m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
+ m_SkyboxMaterial: {fileID: 0}
+ m_HaloStrength: 0.5
+ m_FlareStrength: 1
+ m_FlareFadeSpeed: 3
+ m_HaloTexture: {fileID: 0}
+ m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
+ m_DefaultReflectionMode: 0
+ m_DefaultReflectionResolution: 128
+ m_ReflectionBounces: 1
+ m_ReflectionIntensity: 1
+ m_CustomReflection: {fileID: 0}
+ m_Sun: {fileID: 0}
+ m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
+ m_UseRadianceAmbientProbe: 0
+--- !u!157 &3
+LightmapSettings:
+ m_ObjectHideFlags: 0
+ serializedVersion: 12
+ m_GIWorkflowMode: 1
+ m_GISettings:
+ serializedVersion: 2
+ m_BounceScale: 1
+ m_IndirectOutputScale: 1
+ m_AlbedoBoost: 1
+ m_EnvironmentLightingMode: 0
+ m_EnableBakedLightmaps: 0
+ m_EnableRealtimeLightmaps: 0
+ m_LightmapEditorSettings:
+ serializedVersion: 12
+ m_Resolution: 2
+ m_BakeResolution: 40
+ m_AtlasSize: 1024
+ m_AO: 0
+ m_AOMaxDistance: 1
+ m_CompAOExponent: 1
+ m_CompAOExponentDirect: 0
+ m_ExtractAmbientOcclusion: 0
+ m_Padding: 2
+ m_LightmapParameters: {fileID: 0}
+ m_LightmapsBakeMode: 1
+ m_TextureCompression: 1
+ m_FinalGather: 0
+ m_FinalGatherFiltering: 1
+ m_FinalGatherRayCount: 256
+ m_ReflectionCompression: 2
+ m_MixedBakeMode: 2
+ m_BakeBackend: 1
+ m_PVRSampling: 1
+ m_PVRDirectSampleCount: 32
+ m_PVRSampleCount: 512
+ m_PVRBounces: 2
+ m_PVREnvironmentSampleCount: 256
+ m_PVREnvironmentReferencePointCount: 2048
+ m_PVRFilteringMode: 1
+ m_PVRDenoiserTypeDirect: 1
+ m_PVRDenoiserTypeIndirect: 1
+ m_PVRDenoiserTypeAO: 1
+ m_PVRFilterTypeDirect: 0
+ m_PVRFilterTypeIndirect: 0
+ m_PVRFilterTypeAO: 0
+ m_PVREnvironmentMIS: 1
+ m_PVRCulling: 1
+ m_PVRFilteringGaussRadiusDirect: 1
+ m_PVRFilteringGaussRadiusIndirect: 5
+ m_PVRFilteringGaussRadiusAO: 2
+ m_PVRFilteringAtrousPositionSigmaDirect: 0.5
+ m_PVRFilteringAtrousPositionSigmaIndirect: 2
+ m_PVRFilteringAtrousPositionSigmaAO: 1
+ m_ExportTrainingData: 0
+ m_TrainingDataDestination: TrainingData
+ m_LightProbeSampleCountMultiplier: 4
+ m_LightingDataAsset: {fileID: 0}
+ m_LightingSettings: {fileID: 0}
+--- !u!196 &4
+NavMeshSettings:
+ serializedVersion: 2
+ m_ObjectHideFlags: 0
+ m_BuildSettings:
+ serializedVersion: 3
+ agentTypeID: 0
+ agentRadius: 0.5
+ agentHeight: 2
+ agentSlope: 45
+ agentClimb: 0.4
+ ledgeDropHeight: 0
+ maxJumpAcrossDistance: 0
+ minRegionArea: 2
+ manualCellSize: 0
+ cellSize: 0.16666667
+ manualTileSize: 0
+ tileSize: 256
+ buildHeightMesh: 0
+ maxJobWorkers: 0
+ preserveTilesOutsideBounds: 0
+ debug:
+ m_Flags: 0
+ m_NavMeshData: {fileID: 0}
+--- !u!1 &22879098
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 22879099}
+ - component: {fileID: 22879100}
+ m_Layer: 0
+ m_Name: RopeSImulator
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &22879099
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 22879098}
+ serializedVersion: 2
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_ConstrainProportionsScale: 0
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!114 &22879100
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 22879098}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 27ac133d9e10e544ba603e07122e3359, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ gravity: 5
+ solveIterations: 10
+ constrainStickMinLength: 0.1
+ testPos: {x: 0, y: 0}
+--- !u!1 &1993214202
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1993214205}
+ - component: {fileID: 1993214204}
+ - component: {fileID: 1993214203}
+ m_Layer: 0
+ m_Name: Main Camera
+ m_TagString: MainCamera
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!81 &1993214203
+AudioListener:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1993214202}
+ m_Enabled: 1
+--- !u!20 &1993214204
+Camera:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1993214202}
+ m_Enabled: 1
+ serializedVersion: 2
+ m_ClearFlags: 1
+ m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
+ m_projectionMatrixMode: 1
+ m_GateFitMode: 2
+ m_FOVAxisMode: 0
+ m_Iso: 200
+ m_ShutterSpeed: 0.005
+ m_Aperture: 16
+ m_FocusDistance: 10
+ m_FocalLength: 50
+ m_BladeCount: 5
+ m_Curvature: {x: 2, y: 11}
+ m_BarrelClipping: 0.25
+ m_Anamorphism: 0
+ m_SensorSize: {x: 36, y: 24}
+ m_LensShift: {x: 0, y: 0}
+ m_NormalizedViewPortRect:
+ serializedVersion: 2
+ x: 0
+ y: 0
+ width: 1
+ height: 1
+ near clip plane: 0.3
+ far clip plane: 1000
+ field of view: 60
+ orthographic: 1
+ orthographic size: 5
+ m_Depth: -1
+ m_CullingMask:
+ serializedVersion: 2
+ m_Bits: 4294967295
+ m_RenderingPath: -1
+ m_TargetTexture: {fileID: 0}
+ m_TargetDisplay: 0
+ m_TargetEye: 3
+ m_HDR: 1
+ m_AllowMSAA: 1
+ m_AllowDynamicResolution: 0
+ m_ForceIntoRT: 0
+ m_OcclusionCulling: 1
+ m_StereoConvergence: 10
+ m_StereoSeparation: 0.022
+--- !u!4 &1993214205
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1993214202}
+ serializedVersion: 2
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: -10}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_ConstrainProportionsScale: 0
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!1660057539 &9223372036854775807
+SceneRoots:
+ m_ObjectHideFlags: 0
+ m_Roots:
+ - {fileID: 1993214205}
+ - {fileID: 22879099}
diff --git a/Assets/Scenes/RopeTest.unity.meta b/Assets/Scenes/RopeTest.unity.meta
new file mode 100644
index 0000000..41c5dd9
--- /dev/null
+++ b/Assets/Scenes/RopeTest.unity.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: cfc0abf7f9f0d774f918832b04042f61
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Extensions/GameObjectExtensions.cs b/Assets/Scripts/Extensions/GameObjectExtensions.cs
new file mode 100644
index 0000000..74d8e75
--- /dev/null
+++ b/Assets/Scripts/Extensions/GameObjectExtensions.cs
@@ -0,0 +1,131 @@
+using UnityEngine;
+using System.Linq;
+
+namespace UnityUtils
+{
+ public static class GameObjectExtensions
+ {
+ ///
+ /// This method is used to hide the GameObject in the Hierarchy view.
+ ///
+ ///
+ public static void HideInHierarchy(this GameObject gameObject)
+ {
+ gameObject.hideFlags = HideFlags.HideInHierarchy;
+ }
+
+ ///
+ /// Gets a component of the given type attached to the GameObject. If that type of component does not exist, it adds one.
+ ///
+ ///
+ /// This method is useful when you don't know if a GameObject has a specific type of component,
+ /// but you want to work with that component regardless. Instead of checking and adding the component manually,
+ /// you can use this method to do both operations in one line.
+ ///
+ /// The type of the component to get or add.
+ /// The GameObject to get the component from or add the component to.
+ /// The existing component of the given type, or a new one if no such component exists.
+ public static T GetOrAdd(this GameObject gameObject) where T : Component
+ {
+ T component = gameObject.GetComponent();
+ if (!component) component = gameObject.AddComponent();
+
+ return component;
+ }
+
+ ///
+ /// Returns the object itself if it exists, null otherwise.
+ ///
+ ///
+ /// This method helps differentiate between a null reference and a destroyed Unity object. Unity's "== null" check
+ /// can incorrectly return true for destroyed objects, leading to misleading behaviour. The OrNull method use
+ /// Unity's "null check", and if the object has been marked for destruction, it ensures an actual null reference is returned,
+ /// aiding in correctly chaining operations and preventing NullReferenceExceptions.
+ ///
+ /// The type of the object.
+ /// The object being checked.
+ /// The object itself if it exists and not destroyed, null otherwise.
+ public static T OrNull(this T obj) where T : Object => obj ? obj : null;
+
+ ///
+ /// Destroys all children of the game object
+ ///
+ /// GameObject whose children are to be destroyed.
+ public static void DestroyChildren(this GameObject gameObject)
+ {
+ gameObject.transform.DestroyChildren();
+ }
+
+ ///
+ /// Immediately destroys all children of the given GameObject.
+ ///
+ /// GameObject whose children are to be destroyed.
+ public static void DestroyChildrenImmediate(this GameObject gameObject)
+ {
+ gameObject.transform.DestroyChildrenImmediate();
+ }
+
+ ///
+ /// Enables all child GameObjects associated with the given GameObject.
+ ///
+ /// GameObject whose child GameObjects are to be enabled.
+ public static void EnableChildren(this GameObject gameObject)
+ {
+ gameObject.transform.EnableChildren();
+ }
+
+ ///
+ /// Disables all child GameObjects associated with the given GameObject.
+ ///
+ /// GameObject whose child GameObjects are to be disabled.
+ public static void DisableChildren(this GameObject gameObject)
+ {
+ gameObject.transform.DisableChildren();
+ }
+
+ ///
+ /// Resets the GameObject's transform's position, rotation, and scale to their default values.
+ ///
+ /// GameObject whose transformation is to be reset.
+ public static void ResetTransformation(this GameObject gameObject)
+ {
+ gameObject.transform.Reset();
+ }
+
+ ///
+ /// Returns the hierarchical path in the Unity scene hierarchy for this GameObject.
+ ///
+ /// The GameObject to get the path for.
+ /// A string representing the full hierarchical path of this GameObject in the Unity scene.
+ /// This is a '/'-separated string where each part is the name of a parent, starting from the root parent and ending
+ /// with the name of the specified GameObjects parent.
+ public static string Path(this GameObject gameObject)
+ {
+ return "/" + string.Join("/",
+ gameObject.GetComponentsInParent().Select(t => t.name).Reverse().ToArray());
+ }
+
+ ///
+ /// Returns the full hierarchical path in the Unity scene hierarchy for this GameObject.
+ ///
+ /// The GameObject to get the path for.
+ /// A string representing the full hierarchical path of this GameObject in the Unity scene.
+ /// This is a '/'-separated string where each part is the name of a parent, starting from the root parent and ending
+ /// with the name of the specified GameObject itself.
+ public static string PathFull(this GameObject gameObject)
+ {
+ return gameObject.Path() + "/" + gameObject.name;
+ }
+
+ ///
+ /// Recursively sets the provided layer for this GameObject and all of its descendants in the Unity scene hierarchy.
+ ///
+ /// The GameObject to set layers for.
+ /// The layer number to set for GameObject and all of its descendants.
+ public static void SetLayersRecursively(this GameObject gameObject, int layer)
+ {
+ gameObject.layer = layer;
+ gameObject.transform.ForEveryChild(child => child.gameObject.SetLayersRecursively(layer));
+ }
+ }
+}
diff --git a/Assets/Scripts/Extensions/GameObjectExtensions.cs.meta b/Assets/Scripts/Extensions/GameObjectExtensions.cs.meta
new file mode 100644
index 0000000..8d4cc67
--- /dev/null
+++ b/Assets/Scripts/Extensions/GameObjectExtensions.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 1fc386696b14b914cbae26f3c3a51a5a
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Extensions/TransformExtensions.cs b/Assets/Scripts/Extensions/TransformExtensions.cs
new file mode 100644
index 0000000..ebdb88c
--- /dev/null
+++ b/Assets/Scripts/Extensions/TransformExtensions.cs
@@ -0,0 +1,98 @@
+using System;
+using System.Collections.Generic;
+using UnityEngine;
+using Object = UnityEngine.Object;
+
+namespace UnityUtils
+{
+ public static class TransformExtensions
+ {
+ ///
+ /// Retrieves all the children of a given Transform.
+ ///
+ ///
+ /// This method can be used with LINQ to perform operations on all child Transforms. For example,
+ /// you could use it to find all children with a specific tag, to disable all children, etc.
+ /// Transform implements IEnumerable and the GetEnumerator method which returns an IEnumerator of all its children.
+ ///
+ /// The Transform to retrieve children from.
+ /// An IEnumerable<Transform> containing all the child Transforms of the parent.
+ public static IEnumerable Children(this Transform parent)
+ {
+ foreach (Transform child in parent)
+ {
+ yield return child;
+ }
+ }
+
+ ///
+ /// Resets transform's position, scale and rotation
+ ///
+ /// Transform to use
+ public static void Reset(this Transform transform)
+ {
+ transform.position = Vector3.zero;
+ transform.localRotation = Quaternion.identity;
+ transform.localScale = Vector3.one;
+ }
+
+ ///
+ /// Destroys all child game objects of the given transform.
+ ///
+ /// The Transform whose child game objects are to be destroyed.
+ public static void DestroyChildren(this Transform parent)
+ {
+ parent.ForEveryChild(child => Object.Destroy(child.gameObject));
+ }
+
+ ///
+ /// Immediately destroys all child game objects of the given transform.
+ ///
+ /// The Transform whose child game objects are to be immediately destroyed.
+ public static void DestroyChildrenImmediate(this Transform parent)
+ {
+ parent.ForEveryChild(child => Object.DestroyImmediate(child.gameObject));
+ }
+
+ ///
+ /// Enables all child game objects of the given transform.
+ ///
+ /// The Transform whose child game objects are to be enabled.
+ public static void EnableChildren(this Transform parent)
+ {
+ parent.ForEveryChild(child => child.gameObject.SetActive(true));
+ }
+
+ ///
+ /// Disables all child game objects of the given transform.
+ ///
+ /// The Transform whose child game objects are to be disabled.
+ public static void DisableChildren(this Transform parent)
+ {
+ parent.ForEveryChild(child => child.gameObject.SetActive(false));
+ }
+
+ ///
+ /// Executes a specified action for each child of a given transform.
+ ///
+ /// The parent transform.
+ /// The action to be performed on each child.
+ ///
+ /// This method iterates over all child transforms in reverse order and executes a given action on them.
+ /// The action is a delegate that takes a Transform as parameter.
+ ///
+ public static void ForEveryChild(this Transform parent, System.Action action)
+ {
+ for (var i = parent.childCount - 1; i >= 0; i--)
+ {
+ action(parent.GetChild(i));
+ }
+ }
+
+ [Obsolete("Renamed to ForEveryChild")]
+ static void PerformActionOnChildren(this Transform parent, System.Action action)
+ {
+ parent.ForEveryChild(action);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/Scripts/Extensions/TransformExtensions.cs.meta b/Assets/Scripts/Extensions/TransformExtensions.cs.meta
new file mode 100644
index 0000000..da47cb8
--- /dev/null
+++ b/Assets/Scripts/Extensions/TransformExtensions.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 3bc029dcadc3ccd40ad4c6a3f51eac64
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Extensions/Vector2Extensions.cs b/Assets/Scripts/Extensions/Vector2Extensions.cs
new file mode 100644
index 0000000..8b98d2f
--- /dev/null
+++ b/Assets/Scripts/Extensions/Vector2Extensions.cs
@@ -0,0 +1,35 @@
+using UnityEngine;
+
+namespace UnityUtils
+{
+ public static class Vector2Extensions
+ {
+ ///
+ /// Adds to any x y values of a Vector2
+ ///
+ public static Vector2 Add(this Vector2 vector2, float x = 0, float y = 0)
+ {
+ return new Vector2(vector2.x + x, vector2.y + y);
+ }
+
+ ///
+ /// Sets any x y values of a Vector2
+ ///
+ public static Vector2 With(this Vector2 vector2, float? x = null, float? y = null)
+ {
+ return new Vector2(x ?? vector2.x, y ?? vector2.y);
+ }
+
+ ///
+ /// Returns a Boolean indicating whether the current Vector2 is in a given range from another Vector2
+ ///
+ /// The current Vector2 position
+ /// The Vector2 position to compare against
+ /// The range value to compare against
+ /// True if the current Vector2 is in the given range from the target Vector2, false otherwise
+ public static bool InRangeOf(this Vector2 current, Vector2 target, float range)
+ {
+ return (current - target).sqrMagnitude <= range * range;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/Scripts/Extensions/Vector2Extensions.cs.meta b/Assets/Scripts/Extensions/Vector2Extensions.cs.meta
new file mode 100644
index 0000000..8e79e31
--- /dev/null
+++ b/Assets/Scripts/Extensions/Vector2Extensions.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 69ebf1c43ff162f488b3b1d0ae557d78
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Extensions/Vector3Extensions.cs b/Assets/Scripts/Extensions/Vector3Extensions.cs
new file mode 100644
index 0000000..b5c3fe0
--- /dev/null
+++ b/Assets/Scripts/Extensions/Vector3Extensions.cs
@@ -0,0 +1,60 @@
+using UnityEngine;
+
+namespace UnityUtils
+{
+ public static class Vector3Extensions
+ {
+ ///
+ /// Sets any x y z values of a Vector3
+ ///
+ public static Vector3 With(this Vector3 vector, float? x = null, float? y = null, float? z = null)
+ {
+ return new Vector3(x ?? vector.x, y ?? vector.y, z ?? vector.z);
+ }
+
+ ///
+ /// Adds to any x y z values of a Vector3
+ ///
+ public static Vector3 Add(this Vector3 vector, float x = 0, float y = 0, float z = 0)
+ {
+ return new Vector3(vector.x + x, vector.y + y, vector.z + z);
+ }
+
+ ///
+ /// Returns a Boolean indicating whether the current Vector3 is in a given range from another Vector3
+ ///
+ /// The current Vector3 position
+ /// The Vector3 position to compare against
+ /// The range value to compare against
+ /// True if the current Vector3 is in the given range from the target Vector3, false otherwise
+ public static bool InRangeOf(this Vector3 current, Vector3 target, float range)
+ {
+ return (current - target).sqrMagnitude <= range * range;
+ }
+
+ ///
+ /// Divides two Vector3 objects component-wise.
+ ///
+ ///
+ /// For each component in v0 (x, y, z), it is divided by the corresponding component in v1 if the component in v1 is not zero.
+ /// Otherwise, the component in v0 remains unchanged.
+ ///
+ ///
+ /// Use 'ComponentDivide' to scale a game object proportionally:
+ ///
+ /// myObject.transform.localScale = originalScale.ComponentDivide(targetDimensions);
+ ///
+ /// This scales the object size to fit within the target dimensions while maintaining its original proportions.
+ ///
+ /// The Vector3 object that this method extends.
+ /// The Vector3 object by which v0 is divided.
+ /// A new Vector3 object resulting from the component-wise division.
+ public static Vector3 ComponentDivide(this Vector3 v0, Vector3 v1)
+ {
+ return new Vector3(
+ v1.x != 0 ? v0.x / v1.x : v0.x,
+ v1.y != 0 ? v0.y / v1.y : v0.y,
+ v1.z != 0 ? v0.z / v1.z : v0.z);
+ }
+ }
+}
diff --git a/Assets/Scripts/Extensions/Vector3Extensions.cs.meta b/Assets/Scripts/Extensions/Vector3Extensions.cs.meta
new file mode 100644
index 0000000..2882baf
--- /dev/null
+++ b/Assets/Scripts/Extensions/Vector3Extensions.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: fde3957705d25994292dd59ab09ce951
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/ProjectSettings/ShaderGraphSettings.asset b/ProjectSettings/ShaderGraphSettings.asset
new file mode 100644
index 0000000..9b43acd
--- /dev/null
+++ b/ProjectSettings/ShaderGraphSettings.asset
@@ -0,0 +1,17 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!114 &1
+MonoBehaviour:
+ m_ObjectHideFlags: 53
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 0}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: de02f9e1d18f588468e474319d09a723, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ shaderVariantLimit: 128
+ customInterpolatorErrorThreshold: 32
+ customInterpolatorWarningThreshold: 16