프로그래밍/Unity3D
[Unity3D] 마우스 좌표 카메라 좌표로 변환하기.
시리시안
2016. 2. 22. 16:50
출처 : http://docs.unity3d.com/ScriptReference/Camera.ScreenToWorldPoint.html
1 2 3 4 5 6 7 8 9 10 11 12 | // Draw a yellow sphere in the scene view at the position // on the near plane of the selected camera that is // 100 pixels from lower-left. using UnityEngine; using System.Collections;public class ExampleClass : MonoBehaviour { void OnDrawGizmosSelected() { Camera camera = GetComponent<Camera>(); Vector3 p = camera.ScreenToWorldPoint(new Vector3(100, 100, camera.nearClipPlane)); Gizmos.color = Color.yellow; Gizmos.DrawSphere(p, 0.1F); } } | cs |