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");
}
}
}
'Unity3D > 수업내용' 카테고리의 다른 글
2020.11.05 미니맵 생성 (0) | 2020.11.05 |
---|---|
2020.11.04 코루틴함수(Coroutine) (0) | 2020.11.04 |
2020.11.03 키보드 값에 따라 캐릭터 이동 및 회전 (0) | 2020.11.03 |
Unity 작업 Tip! (0) | 2020.10.30 |
2020.10.29 캐릭터 벽 이동 후 돌아보기 (0) | 2020.10.29 |