aboutsummaryrefslogtreecommitdiff
path: root/JamHelper/Assets/JamUtils/Scripts
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2022-02-18 14:38:20 +0800
committerchai <chaifix@163.com>2022-02-18 14:38:20 +0800
commit63795c45af9ecca5aea36fbe291b18fcd9fb9b7d (patch)
tree60d811d8a0b1944ab32d24aa28394183b82cadeb /JamHelper/Assets/JamUtils/Scripts
parenta41c8da0787e0285d4c5b16a5cf5bc3e7a34f521 (diff)
*rename folder name
Diffstat (limited to 'JamHelper/Assets/JamUtils/Scripts')
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Character.meta8
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Character/CameraFollow.cs8
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Character/CameraFollow.cs.meta11
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Input.meta8
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Input/LiteInputManager.meta8
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Input/LiteInputManager/LiteInputManager.cs19
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Input/LiteInputManager/LiteInputManager.cs.meta11
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Math.meta8
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Math/MathUtils.cs15
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Math/MathUtils.cs.meta11
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Math/Vector2Utils.cs18
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Math/Vector2Utils.cs.meta11
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Math/Vector3Utils.cs18
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Math/Vector3Utils.cs.meta11
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Network.meta8
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Projectile.meta8
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Projectile/SphereBullet.cs27
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Projectile/SphereBullet.cs.meta11
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Props.meta8
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Props/SliderDoor.cs18
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Props/SliderDoor.cs.meta11
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity.meta8
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity/InterpolationFactorController.cs58
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity/InterpolationFactorController.cs.meta11
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity/InterpolationObjectController.cs117
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity/InterpolationObjectController.cs.meta11
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity/README.md12
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity/README.md.meta7
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity/Tests.meta8
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity/Tests/TestMotion.cs18
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity/Tests/TestMotion.cs.meta11
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/TestCollision.cs51
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/TestCollision.cs.meta11
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/UI.meta8
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/UI/UIPanelBase.cs19
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/UI/UIPanelBase.cs.meta11
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Utils.meta8
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Utils/ColliderUtility.cs59
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Utils/ColliderUtility.cs.meta11
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Utils/Editor.meta8
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Utils/Editor/MeshRendererEditor.cs35
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Utils/Editor/MeshRendererEditor.cs.meta11
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Utils/GizmosHandle.cs42
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Utils/GizmosHandle.cs.meta11
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Utils/MeshRendererOrderModifier.cs21
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Utils/MeshRendererOrderModifier.cs.meta11
-rw-r--r--JamHelper/Assets/JamUtils/Scripts/Vehicles.meta8
47 files changed, 842 insertions, 0 deletions
diff --git a/JamHelper/Assets/JamUtils/Scripts/Character.meta b/JamHelper/Assets/JamUtils/Scripts/Character.meta
new file mode 100644
index 0000000..2ab61ed
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Character.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 33fb2087c14c1bb44aea949d2e0803fc
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JamHelper/Assets/JamUtils/Scripts/Character/CameraFollow.cs b/JamHelper/Assets/JamUtils/Scripts/Character/CameraFollow.cs
new file mode 100644
index 0000000..c711f87
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Character/CameraFollow.cs
@@ -0,0 +1,8 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace JamTools
+{
+
+} \ No newline at end of file
diff --git a/JamHelper/Assets/JamUtils/Scripts/Character/CameraFollow.cs.meta b/JamHelper/Assets/JamUtils/Scripts/Character/CameraFollow.cs.meta
new file mode 100644
index 0000000..462f5e4
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Character/CameraFollow.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 941c680575cd4044891a853d36911609
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JamHelper/Assets/JamUtils/Scripts/Input.meta b/JamHelper/Assets/JamUtils/Scripts/Input.meta
new file mode 100644
index 0000000..0f2e279
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Input.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: a89ccbe837e61954eb8db6fd8d8cc6fa
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JamHelper/Assets/JamUtils/Scripts/Input/LiteInputManager.meta b/JamHelper/Assets/JamUtils/Scripts/Input/LiteInputManager.meta
new file mode 100644
index 0000000..478a2fb
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Input/LiteInputManager.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: b109ec0d332e7d542933c14195555fc5
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JamHelper/Assets/JamUtils/Scripts/Input/LiteInputManager/LiteInputManager.cs b/JamHelper/Assets/JamUtils/Scripts/Input/LiteInputManager/LiteInputManager.cs
new file mode 100644
index 0000000..b1b41ad
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Input/LiteInputManager/LiteInputManager.cs
@@ -0,0 +1,19 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace JamTools
+{
+
+ public class LiteInputManager : MonoBehaviour
+ {
+
+
+ private void Update()
+ {
+
+ }
+
+ }
+
+}
diff --git a/JamHelper/Assets/JamUtils/Scripts/Input/LiteInputManager/LiteInputManager.cs.meta b/JamHelper/Assets/JamUtils/Scripts/Input/LiteInputManager/LiteInputManager.cs.meta
new file mode 100644
index 0000000..ea233ec
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Input/LiteInputManager/LiteInputManager.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 43d60c2791534e944a76fe9bd04611c7
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JamHelper/Assets/JamUtils/Scripts/Math.meta b/JamHelper/Assets/JamUtils/Scripts/Math.meta
new file mode 100644
index 0000000..dee15cb
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Math.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: ed50ccfb24d775b4dafa806f920fb966
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JamHelper/Assets/JamUtils/Scripts/Math/MathUtils.cs b/JamHelper/Assets/JamUtils/Scripts/Math/MathUtils.cs
new file mode 100644
index 0000000..fb2378e
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Math/MathUtils.cs
@@ -0,0 +1,15 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace JamTools
+{
+
+ public class MathUtils
+ {
+
+
+
+ }
+
+} \ No newline at end of file
diff --git a/JamHelper/Assets/JamUtils/Scripts/Math/MathUtils.cs.meta b/JamHelper/Assets/JamUtils/Scripts/Math/MathUtils.cs.meta
new file mode 100644
index 0000000..fb47325
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Math/MathUtils.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: c8fdae86a38bbd34b877e4c49185866b
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JamHelper/Assets/JamUtils/Scripts/Math/Vector2Utils.cs b/JamHelper/Assets/JamUtils/Scripts/Math/Vector2Utils.cs
new file mode 100644
index 0000000..ad23394
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Math/Vector2Utils.cs
@@ -0,0 +1,18 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class Vector2Utils : MonoBehaviour
+{
+ // Start is called before the first frame update
+ void Start()
+ {
+
+ }
+
+ // Update is called once per frame
+ void Update()
+ {
+
+ }
+}
diff --git a/JamHelper/Assets/JamUtils/Scripts/Math/Vector2Utils.cs.meta b/JamHelper/Assets/JamUtils/Scripts/Math/Vector2Utils.cs.meta
new file mode 100644
index 0000000..baaaadc
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Math/Vector2Utils.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: b942375dd102510458322e9b4fed90a6
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JamHelper/Assets/JamUtils/Scripts/Math/Vector3Utils.cs b/JamHelper/Assets/JamUtils/Scripts/Math/Vector3Utils.cs
new file mode 100644
index 0000000..11acfe7
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Math/Vector3Utils.cs
@@ -0,0 +1,18 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class Vector3Utils : MonoBehaviour
+{
+ // Start is called before the first frame update
+ void Start()
+ {
+
+ }
+
+ // Update is called once per frame
+ void Update()
+ {
+
+ }
+}
diff --git a/JamHelper/Assets/JamUtils/Scripts/Math/Vector3Utils.cs.meta b/JamHelper/Assets/JamUtils/Scripts/Math/Vector3Utils.cs.meta
new file mode 100644
index 0000000..d0d6741
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Math/Vector3Utils.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 8720e69e758fe914d8fd09cda9ac1dfa
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JamHelper/Assets/JamUtils/Scripts/Network.meta b/JamHelper/Assets/JamUtils/Scripts/Network.meta
new file mode 100644
index 0000000..5d70b8f
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Network.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: fbccedc936aea7342b072fc73ccbc9eb
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JamHelper/Assets/JamUtils/Scripts/Projectile.meta b/JamHelper/Assets/JamUtils/Scripts/Projectile.meta
new file mode 100644
index 0000000..fc0b718
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Projectile.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 5f5a1b6c5dc537a4bac6d25da2789a4e
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JamHelper/Assets/JamUtils/Scripts/Projectile/SphereBullet.cs b/JamHelper/Assets/JamUtils/Scripts/Projectile/SphereBullet.cs
new file mode 100644
index 0000000..772f8eb
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Projectile/SphereBullet.cs
@@ -0,0 +1,27 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class SphereBullet : MonoBehaviour
+{
+ // Start is called before the first frame update
+ void Start()
+ {
+
+ }
+
+ // Update is called once per frame
+ void Update()
+ {
+
+ }
+
+ private void OnCollisionEnter(Collision collision)
+ {
+ }
+
+ private void OnCollisionExit(Collision collision)
+ {
+ // Destroy(this.gameObject);
+ }
+}
diff --git a/JamHelper/Assets/JamUtils/Scripts/Projectile/SphereBullet.cs.meta b/JamHelper/Assets/JamUtils/Scripts/Projectile/SphereBullet.cs.meta
new file mode 100644
index 0000000..3c7d7a6
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Projectile/SphereBullet.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: b04ac7939fcad834eb7f307bc80ecf3b
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JamHelper/Assets/JamUtils/Scripts/Props.meta b/JamHelper/Assets/JamUtils/Scripts/Props.meta
new file mode 100644
index 0000000..2c6be10
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Props.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 3e5567d87e40a064b9defd283282150c
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JamHelper/Assets/JamUtils/Scripts/Props/SliderDoor.cs b/JamHelper/Assets/JamUtils/Scripts/Props/SliderDoor.cs
new file mode 100644
index 0000000..0438b58
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Props/SliderDoor.cs
@@ -0,0 +1,18 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class SliderDoor : MonoBehaviour
+{
+ // Start is called before the first frame update
+ void Start()
+ {
+
+ }
+
+ // Update is called once per frame
+ void Update()
+ {
+
+ }
+}
diff --git a/JamHelper/Assets/JamUtils/Scripts/Props/SliderDoor.cs.meta b/JamHelper/Assets/JamUtils/Scripts/Props/SliderDoor.cs.meta
new file mode 100644
index 0000000..45b033f
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Props/SliderDoor.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 4dc113f39388b8d4a8f1fb38cbf5cbd3
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity.meta b/JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity.meta
new file mode 100644
index 0000000..4c9a6c9
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 27aa6a2b9b6bc35439e3d59b7090f631
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity/InterpolationFactorController.cs b/JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity/InterpolationFactorController.cs
new file mode 100644
index 0000000..efb96f3
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity/InterpolationFactorController.cs
@@ -0,0 +1,58 @@
+using UnityEngine;
+
+[DisallowMultipleComponent]
+[DefaultExecutionOrder(ORDER_EXECUTION)]
+public class InterpolationFactorController : MonoBehaviour
+{
+ public const int ORDER_EXECUTION = -1000;
+
+ private static InterpolationFactorController Instance;
+ private float[] _lastFixedUpdates = new float[2];
+ private int _lastIndex;
+
+ public static float Factor { get; private set; }
+
+ private void Awake()
+ {
+ if (Instance)
+ {
+ Destroy(this);
+ Debug.LogWarning($"The '{typeof(InterpolationFactorController).Name}' is a singleton!");
+ return;
+ }
+
+ Instance = this;
+ Factor = 1;
+ }
+
+ private void Start()
+ {
+ _lastFixedUpdates = new float[2] { Time.fixedTime, Time.fixedTime };
+ _lastIndex = 0;
+ }
+
+ private void FixedUpdate()
+ {
+ _lastIndex = NextIndex();
+ _lastFixedUpdates[_lastIndex] = Time.fixedTime;
+ }
+
+ private void Update()
+ {
+ float lastTime = _lastFixedUpdates[_lastIndex];
+ float prevTime = _lastFixedUpdates[NextIndex()];
+
+ if (lastTime == prevTime)
+ {
+ Factor = 1;
+ return;
+ }
+
+ Factor = (Time.time - lastTime) / (lastTime - prevTime);
+ }
+
+ private int NextIndex()
+ {
+ return (_lastIndex == 0) ? 1 : 0;
+ }
+}
diff --git a/JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity/InterpolationFactorController.cs.meta b/JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity/InterpolationFactorController.cs.meta
new file mode 100644
index 0000000..ca7364a
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity/InterpolationFactorController.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 63b841e9c9589044db9f0b7edfca90bd
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: -95
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity/InterpolationObjectController.cs b/JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity/InterpolationObjectController.cs
new file mode 100644
index 0000000..9a83fe0
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity/InterpolationObjectController.cs
@@ -0,0 +1,117 @@
+using System.Collections;
+using UnityEngine;
+
+[DisallowMultipleComponent]
+[DefaultExecutionOrder(ORDER_EXECUTION)]
+public class InterpolationObjectController : MonoBehaviour
+{
+ public const int ORDER_EXECUTION = InterpolationFactorController.ORDER_EXECUTION - 1;
+
+ private TransformData[] _transforms;
+ private int _index;
+
+ private void Awake()
+ {
+ StartCoroutine(WaitForEndOfFrame());
+ StartCoroutine(WaitForFixedUpdate());
+ }
+
+ private void OnEnable()
+ {
+ ResetTransforms();
+ }
+
+ private void BeforeFixedUpdate()
+ {
+ // Restoring actual transform for the FixedUpdate() cal where it could be change by the user.
+ RestoreActualTransform();
+ }
+
+ private void AfterFixedUpdate()
+ {
+ // Saving actual transform for being restored in the BeforeFixedUpdate() method.
+ SaveActualTransform();
+ }
+
+ private void Update()
+ {
+ // Set interpolated transform for being rendered.
+ SetInterpolatedTransform();
+ }
+
+ #region Helpers
+
+ private void RestoreActualTransform()
+ {
+ var latest = _transforms[_index];
+ transform.localPosition = latest.position;
+ transform.localScale = latest.scale;
+ transform.localRotation = latest.rotation;
+ }
+
+ private void SaveActualTransform()
+ {
+ _index = NextIndex();
+ _transforms[_index] = CurrentTransformData();
+ }
+
+ private void SetInterpolatedTransform()
+ {
+ var prev = _transforms[NextIndex()];
+ float factor = InterpolationFactorController.Factor;
+ transform.localPosition = Vector3.Lerp(prev.position, transform.localPosition, factor);
+ transform.localRotation = Quaternion.Slerp(prev.rotation, transform.localRotation, factor);
+ transform.localScale = Vector3.Lerp(prev.scale, transform.localScale, factor);
+ }
+
+ public void ResetTransforms()
+ {
+ _index = 0;
+ var td = CurrentTransformData();
+ _transforms = new TransformData[2] { td, td };
+ }
+
+ private TransformData CurrentTransformData()
+ {
+ return new TransformData(transform.localPosition, transform.localRotation, transform.localScale);
+ }
+
+ private int NextIndex()
+ {
+ return (_index == 0) ? 1 : 0;
+ }
+
+ private IEnumerator WaitForEndOfFrame()
+ {
+ while (true)
+ {
+ yield return new WaitForEndOfFrame();
+ BeforeFixedUpdate();
+ }
+ }
+
+ private IEnumerator WaitForFixedUpdate()
+ {
+ while (true)
+ {
+ yield return new WaitForFixedUpdate();
+ AfterFixedUpdate();
+ }
+ }
+
+ private struct TransformData
+ {
+ public Vector3 position;
+ public Quaternion rotation;
+ public Vector3 scale;
+
+ public TransformData(Vector3 position, Quaternion rotation, Vector3 scale)
+ {
+ this.position = position;
+ this.rotation = rotation;
+ this.scale = scale;
+ }
+ }
+
+ #endregion
+}
diff --git a/JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity/InterpolationObjectController.cs.meta b/JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity/InterpolationObjectController.cs.meta
new file mode 100644
index 0000000..80c49da
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity/InterpolationObjectController.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 60e373202cc879c4a8e781f92dbdcb48
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: -90
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity/README.md b/JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity/README.md
new file mode 100644
index 0000000..016072b
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity/README.md
@@ -0,0 +1,12 @@
+# Smooth Motion in Unity (refactored)
+
+This is an improved (refactored) version of the code from the ["Timesteps and Achieving Smooth Motion in Unity"](https://www.kinematicsoup.com/news/2016/8/9/rrypp5tkubynjwxhxjzd42s3o034o8?utm_source=youtube&utm_type=SMVideo) article.
+
+Now, there are only 2 components instead of original 3:
+
+1. [`InterpolationFactorController`](https://github.com/DevelAx/Smooth-Motion-in-Unity/blob/master/InterpolationFactorController.cs) a singleton scene component (the original name was `InterpolationController`) that calculates the current *interpolation factor*.
+2. [`InterpolationObjectController`](https://github.com/DevelAx/Smooth-Motion-in-Unity/blob/master/InterpolationObjectController.cs) a component for a moving object (the original name was `InterpolatedTransform`) which calculates the current interpolation for the object in the `Update()` method before it's being rendered and then restores its original `transform` values for the next `FixedUpdate()` call.
+3. The `InterpolatedTransformUpdater` component was removed as unnecessary.
+
+## Remarks
+For these scripts to work correctly the user's script must change the object's `transform` only in the `FixedUpdate()` method. When teleporting the object the user should call the (`InterpolationObjectController`).`ResetTransforms()` method after it.
diff --git a/JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity/README.md.meta b/JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity/README.md.meta
new file mode 100644
index 0000000..b5455ff
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity/README.md.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 933a0ade2c59f904c9eed3fb284afb77
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity/Tests.meta b/JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity/Tests.meta
new file mode 100644
index 0000000..74a5329
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity/Tests.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 2255b40400c2ac8469bc94ee99676fb4
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity/Tests/TestMotion.cs b/JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity/Tests/TestMotion.cs
new file mode 100644
index 0000000..3bf706a
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity/Tests/TestMotion.cs
@@ -0,0 +1,18 @@
+using UnityEngine;
+
+/// <summary>
+/// Use this component with a game object for demonstration purposes.
+/// </summary>
+[DisallowMultipleComponent]
+[RequireComponent(typeof(InterpolationObjectController))]
+public class TestMotion : MonoBehaviour
+{
+ [SerializeField]
+ private float _speed = 2f;
+
+ private void FixedUpdate()
+ {
+ transform.position += Vector3.right * _speed * Time.fixedDeltaTime;
+ transform.rotation = Quaternion.Euler(transform.rotation.eulerAngles.x, transform.rotation.eulerAngles.y + _speed * 30 * Time.fixedDeltaTime, transform.rotation.eulerAngles.z);
+ }
+}
diff --git a/JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity/Tests/TestMotion.cs.meta b/JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity/Tests/TestMotion.cs.meta
new file mode 100644
index 0000000..fe06ffe
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Smooth-Motion-in-Unity/Tests/TestMotion.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 80afb4adbb1d67247ac41a23d04b67d7
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JamHelper/Assets/JamUtils/Scripts/TestCollision.cs b/JamHelper/Assets/JamUtils/Scripts/TestCollision.cs
new file mode 100644
index 0000000..87b018f
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/TestCollision.cs
@@ -0,0 +1,51 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class TestCollision : MonoBehaviour
+{
+ // Start is called before the first frame update
+ void Start()
+ {
+
+ }
+
+ // Update is called once per frame
+ void Update()
+ {
+
+ }
+
+ private void OnCollisionEnter(Collision collision)
+ {
+ Debug.Log("OnCollisionEnter");
+
+ }
+
+ private void OnCollisionStay(Collision collision)
+ {
+
+ }
+
+ private void OnCollisionExit(Collision collision)
+ {
+
+ }
+
+
+ private void OnTriggerEnter(Collider other)
+ {
+ Debug.Log("OnTriggerEnter");
+
+ }
+
+ private void OnTriggerStay(Collider other)
+ {
+
+ }
+
+ private void OnTriggerExit(Collider other)
+ {
+ }
+
+}
diff --git a/JamHelper/Assets/JamUtils/Scripts/TestCollision.cs.meta b/JamHelper/Assets/JamUtils/Scripts/TestCollision.cs.meta
new file mode 100644
index 0000000..4d5ff9b
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/TestCollision.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 08a344d0f26d38142afbf1868e8e57b6
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JamHelper/Assets/JamUtils/Scripts/UI.meta b/JamHelper/Assets/JamUtils/Scripts/UI.meta
new file mode 100644
index 0000000..75d543c
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/UI.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 64284bd8573737f478b1adacb050bfae
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JamHelper/Assets/JamUtils/Scripts/UI/UIPanelBase.cs b/JamHelper/Assets/JamUtils/Scripts/UI/UIPanelBase.cs
new file mode 100644
index 0000000..b3dee94
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/UI/UIPanelBase.cs
@@ -0,0 +1,19 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace JamTools
+{
+
+ //
+ public class UIPanelBase : MonoBehaviour
+ {
+
+ protected void Set()
+ {
+
+ }
+
+ }
+
+}
diff --git a/JamHelper/Assets/JamUtils/Scripts/UI/UIPanelBase.cs.meta b/JamHelper/Assets/JamUtils/Scripts/UI/UIPanelBase.cs.meta
new file mode 100644
index 0000000..931e924
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/UI/UIPanelBase.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: e9837ab97fa4d834c8b987cea27424ca
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JamHelper/Assets/JamUtils/Scripts/Utils.meta b/JamHelper/Assets/JamUtils/Scripts/Utils.meta
new file mode 100644
index 0000000..597e961
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Utils.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 293c2bbf046636f45aa82a0bcde4497c
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JamHelper/Assets/JamUtils/Scripts/Utils/ColliderUtility.cs b/JamHelper/Assets/JamUtils/Scripts/Utils/ColliderUtility.cs
new file mode 100644
index 0000000..3efe155
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Utils/ColliderUtility.cs
@@ -0,0 +1,59 @@
+using System;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace JamTools
+{
+
+ public static class ColliderUtility
+ {
+ private static readonly List<Vector3> s_Vertices = new List<Vector3>();
+
+ private static readonly List<int> s_Triangles = new List<int>();
+
+ private static Plane GetWorldTriangle(Transform collider, int index)
+ {
+ Vector3 position = ColliderUtility.s_Vertices[ColliderUtility.s_Triangles[3 * index]];
+ Vector3 position2 = ColliderUtility.s_Vertices[ColliderUtility.s_Triangles[3 * index + 1]];
+ Vector3 position3 = ColliderUtility.s_Vertices[ColliderUtility.s_Triangles[3 * index + 2]];
+ return new Plane(collider.TransformPoint(position), collider.TransformPoint(position2), collider.TransformPoint(position3));
+ }
+
+ public static Vector3 FindClosestPoint(Collider collider, Vector3 position)
+ {
+ return ColliderUtility.FindClosestPoint(collider, position, false);
+ }
+
+ public static Vector3 FindClosestPoint(Collider collider, Vector3 position, bool ignoreVerticalTriangles)
+ {
+ MeshCollider meshCollider;
+ if ((meshCollider = (collider as MeshCollider)) != null && !meshCollider.convex)
+ {
+ Mesh sharedMesh = meshCollider.sharedMesh;
+ sharedMesh.GetVertices(ColliderUtility.s_Vertices);
+ Plane plane = default(Plane);
+ float num = float.PositiveInfinity;
+ for (int i = 0; i < sharedMesh.subMeshCount; i++)
+ {
+ sharedMesh.GetTriangles(ColliderUtility.s_Triangles, i);
+ int j = 0;
+ int num2 = ColliderUtility.s_Triangles.Count / 3;
+ while (j < num2)
+ {
+ Plane worldTriangle = ColliderUtility.GetWorldTriangle(meshCollider.transform, j);
+ float num3 = Mathf.Abs(worldTriangle.GetDistanceToPoint(position));
+ if ((!ignoreVerticalTriangles || (!(worldTriangle.normal == Vector3.up) && !(worldTriangle.normal == Vector3.down))) && ((i == 0 && j == 0) || num3 < num))
+ {
+ plane = worldTriangle;
+ num = num3;
+ }
+ j++;
+ }
+ }
+ return plane.ClosestPointOnPlane(position);
+ }
+ return collider.ClosestPoint(position);
+ }
+ }
+
+}
diff --git a/JamHelper/Assets/JamUtils/Scripts/Utils/ColliderUtility.cs.meta b/JamHelper/Assets/JamUtils/Scripts/Utils/ColliderUtility.cs.meta
new file mode 100644
index 0000000..4d828ca
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Utils/ColliderUtility.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 17d16ee713041694bb7486e050909dd8
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JamHelper/Assets/JamUtils/Scripts/Utils/Editor.meta b/JamHelper/Assets/JamUtils/Scripts/Utils/Editor.meta
new file mode 100644
index 0000000..292ca3d
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Utils/Editor.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: f0d601d32de9dd74aa29e699ca3bb0ba
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JamHelper/Assets/JamUtils/Scripts/Utils/Editor/MeshRendererEditor.cs b/JamHelper/Assets/JamUtils/Scripts/Utils/Editor/MeshRendererEditor.cs
new file mode 100644
index 0000000..139072a
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Utils/Editor/MeshRendererEditor.cs
@@ -0,0 +1,35 @@
+using UnityEngine;
+using UnityEditor;
+
+[CustomEditor(typeof(MeshRenderer))]
+public class MeshRendererEditor : Editor
+{
+ MeshRenderer meshRenderer;
+ public override void OnInspectorGUI()
+ {
+ base.OnInspectorGUI();
+ meshRenderer = target as MeshRenderer;
+
+ string[] layerNames = new string[SortingLayer.layers.Length];
+ for (int i = 0; i < SortingLayer.layers.Length; i++)
+ layerNames[i] = SortingLayer.layers[i].name;
+
+ int layerValue = SortingLayer.GetLayerValueFromName(meshRenderer.sortingLayerName);
+ layerValue = EditorGUILayout.Popup("Sorting Layer", layerValue, layerNames);
+
+ GUI.changed = false;
+
+ SortingLayer layer = SortingLayer.layers[layerValue];
+ meshRenderer.sortingLayerName = layer.name;
+ meshRenderer.sortingLayerID = layer.id;
+ meshRenderer.sortingOrder = EditorGUILayout.IntField("Order in Layer", meshRenderer.sortingOrder);
+
+ if (GUI.changed)
+ {
+ EditorUtility.SetDirty(meshRenderer);
+ AssetDatabase.SaveAssets();
+ AssetDatabase.Refresh();
+ }
+
+ }
+} \ No newline at end of file
diff --git a/JamHelper/Assets/JamUtils/Scripts/Utils/Editor/MeshRendererEditor.cs.meta b/JamHelper/Assets/JamUtils/Scripts/Utils/Editor/MeshRendererEditor.cs.meta
new file mode 100644
index 0000000..76fc308
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Utils/Editor/MeshRendererEditor.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 80862adc8955f0c4b8edde2e46cda527
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JamHelper/Assets/JamUtils/Scripts/Utils/GizmosHandle.cs b/JamHelper/Assets/JamUtils/Scripts/Utils/GizmosHandle.cs
new file mode 100644
index 0000000..360eecd
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Utils/GizmosHandle.cs
@@ -0,0 +1,42 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace JamTools
+{
+
+ public class GizmosHandle : MonoBehaviour
+ {
+ public Action onDrawGizmos;
+
+ private static GizmosHandle m_Instance;
+
+ public static GizmosHandle Instance
+ {
+ get
+ {
+ return m_Instance;
+ }
+ }
+
+ public void DoGizmos(Action doGizmos)
+ {
+ onDrawGizmos += doGizmos;
+ }
+
+ private void Awake()
+ {
+ m_Instance = this;
+ }
+
+ private void OnDrawGizmos()
+ {
+ if (onDrawGizmos != null)
+ onDrawGizmos();
+ onDrawGizmos = null;
+ }
+
+ }
+
+}
diff --git a/JamHelper/Assets/JamUtils/Scripts/Utils/GizmosHandle.cs.meta b/JamHelper/Assets/JamUtils/Scripts/Utils/GizmosHandle.cs.meta
new file mode 100644
index 0000000..43d7e19
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Utils/GizmosHandle.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 8790b951567cc8942a748fde536a3fe0
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JamHelper/Assets/JamUtils/Scripts/Utils/MeshRendererOrderModifier.cs b/JamHelper/Assets/JamUtils/Scripts/Utils/MeshRendererOrderModifier.cs
new file mode 100644
index 0000000..40fe5bd
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Utils/MeshRendererOrderModifier.cs
@@ -0,0 +1,21 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class MeshRendererOrderModifier : MonoBehaviour
+{
+ [SerializeField] private string m_RenderLayer;
+ [SerializeField] private int m_RenderOrder;
+
+ private MeshRenderer m_MeshRenderer;
+
+ void Start()
+ {
+ m_MeshRenderer = GetComponent<MeshRenderer>();
+ if(m_MeshRenderer != null)
+ {
+ m_MeshRenderer.sortingLayerID = SortingLayer.NameToID(m_RenderLayer);
+ m_MeshRenderer.sortingOrder = m_RenderOrder;
+ }
+ }
+}
diff --git a/JamHelper/Assets/JamUtils/Scripts/Utils/MeshRendererOrderModifier.cs.meta b/JamHelper/Assets/JamUtils/Scripts/Utils/MeshRendererOrderModifier.cs.meta
new file mode 100644
index 0000000..18fab3b
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Utils/MeshRendererOrderModifier.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: bbbbac06de34c484daaf3d065f8fe527
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/JamHelper/Assets/JamUtils/Scripts/Vehicles.meta b/JamHelper/Assets/JamUtils/Scripts/Vehicles.meta
new file mode 100644
index 0000000..bcc2f75
--- /dev/null
+++ b/JamHelper/Assets/JamUtils/Scripts/Vehicles.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: b04a2ad22c70f9f4ab73013caa31233e
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant: