KITASENJU DESIGN BLOG

memo, html, javascript, unity

hitTest

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class HitTest : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        
    }

    void OnCollisionStay(Collision collision)
    {
        Debug.Log("当たっている");
    }

    void OnCollisionEnter(Collision collision)
    {
        Debug.Log(collision.gameObject.name); // ぶつかった相手の名前を取得
    }

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

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


    // Update is called once per frame
    void Update()
    {
        
    }
}
"FOOTER"