Main Script

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

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

    // Update is called once per frame
    void Update()
    {
        if  (Input.GetMouseButtonUp(0))
        // 마우스 좌측 
        {
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            Debug.DrawRay(ray.origin, ray.direction * 1000, Color.red, 2.0f);
            RaycastHit hit;
            if (Physics.Raycast(ray.origin, ray.direction, out hit, 1000))
            {
                Debug.Log(hit.point);
            }
            Debug.Log("Click");
        }
        
    }
}

 

 

+ Recent posts