diff options
Diffstat (limited to 'JamHelper/Assets/JamUtils/FirstPersonCharacterController/Rigidbody/MoveByVelocity/Scripts/GroundChecker.cs')
-rw-r--r-- | JamHelper/Assets/JamUtils/FirstPersonCharacterController/Rigidbody/MoveByVelocity/Scripts/GroundChecker.cs | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/JamHelper/Assets/JamUtils/FirstPersonCharacterController/Rigidbody/MoveByVelocity/Scripts/GroundChecker.cs b/JamHelper/Assets/JamUtils/FirstPersonCharacterController/Rigidbody/MoveByVelocity/Scripts/GroundChecker.cs new file mode 100644 index 0000000..279786d --- /dev/null +++ b/JamHelper/Assets/JamUtils/FirstPersonCharacterController/Rigidbody/MoveByVelocity/Scripts/GroundChecker.cs @@ -0,0 +1,48 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace JamUtils +{ + + public class GroundChecker : MonoBehaviour + { + [SerializeField] private Transform m_Foot; + + private List<Collider> m_Colliders = new List<Collider>(); + + public Transform foot + { + get + { + return m_Foot; + } + } + + public bool isOnGround + { + get + { + return m_Colliders.Count != 0; + } + } + + private void OnTriggerEnter(Collider other) + { + if (!m_Colliders.Contains(other)) + m_Colliders.Add(other); + } + + private void OnTriggerExit(Collider other) + { + if (m_Colliders.Contains(other)) + m_Colliders.Remove(other); + } + + private void OnTriggerStay(Collider other) + { + } + + } + +} |