首页 > 代码库 > 经常会用到的碰撞检测方法

经常会用到的碰撞检测方法

using UnityEngine;
using System.Collections;

public class PlayerTrigger : MonoBehaviour {

    void OnTriggerEnter(Collider other)
    {
        Debug.Log ("Enter");
    }

    void OnTriggerStay(Collider other)
    {
        Debug.Log("Stay");
    }

    void OnTriggerExit(Collider other)
    {
        Debug.Log ("Exit");
    }
}

技术分享

经常会用到的碰撞检测方法