update: now player uses additional collider to detect ground
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class GroundDetector : MonoBehaviour
|
||||
{
|
||||
public bool onGround { get; private set; } = false;
|
||||
|
||||
void OnTriggerEnter(Collider other) {
|
||||
if (other.CompareTag("Ground")) onGround = true;
|
||||
}
|
||||
void OnTriggerStay(Collider other) { OnTriggerEnter(other); }
|
||||
void OnTriggerExit(Collider other) {
|
||||
if (other.CompareTag("Ground")) onGround = false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user