<<スクリプト>>
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GroundCheck : MonoBehaviour
{
private void OnTriggerStay(Collider other)
{
if(other.CompareTag("Ground"))
{
print("接地!");
}
}
private void OnTriggerExit(Collider other)
{
if (other.CompareTag("Ground"))
{
print("離れた!");
}
}
}
<<設定>>
親オブジェクトの前部付近に「Sphere Collidr」を設定する。

Colliderの位置と大きさを調整すれば、「坂道の接地判定」にも対応可能です。

<<実行結果>>
