카테고리 없음

Unity3d 카메라에서 나오는 레이

hyuckkim 2021. 4. 2. 00:26
using UnityEngine;
using System.Collections;

public class ExampleScript : MonoBehaviour {
    public Camera camera;

    void Start(){
        RaycastHit hit;
        Ray ray = camera.ScreenPointToRay(Input.mousePosition);
        
        if (Physics.Raycast(ray, out hit)) {
            Transform objectHit = hit.transform;
            
            // Do something with the object that was hit by the raycast.
        }
    }
}

계속 찾아서 계속 가져올 바에야 여기 두자.

 

여기 있음.

카메라에서 나오는 레이 - Unity 매뉴얼 (unity3d.com)

 

카메라에서 나오는 레이 - Unity 매뉴얼

뷰 절두체의 이해 섹션에서는 카메라의 뷰에서 모든 점은 월드 공간의 하나의 선에 대응된다고 설명했습니다. 때로는 그 선의 수학적인 표현을 사용하는 것이 편리한 경우가 있으며 Unity는 이것

docs.unity3d.com