fix: player now jumps normally

This commit is contained in:
KOSMOGOR
2025-04-24 14:02:23 +03:00
parent de6739cdfa
commit 851ee23092
3 changed files with 35 additions and 11 deletions
+4 -3
View File
@@ -2,13 +2,14 @@ using UnityEngine;
public class GroundDetector : MonoBehaviour
{
public LayerMask groundMask;
public bool onGround { get; private set; } = false;
void OnTriggerEnter(Collider other) {
if (other.CompareTag("Ground")) onGround = true;
public void OnTriggerEnter(Collider other) {
if ((1 << other.gameObject.layer & groundMask) != 0) onGround = true;
}
void OnTriggerStay(Collider other) { OnTriggerEnter(other); }
void OnTriggerExit(Collider other) {
if (other.CompareTag("Ground")) onGround = false;
if ((1 << other.gameObject.layer & groundMask) != 0) onGround = false;
}
}