Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

raycast from camera to mouse unity

Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out RaycastHit hit, 100)) {
	Debug.Log(hit.transform.name);
	Debug.Log("hit");
}
 
PREVIOUS NEXT
Tagged: #raycast #camera #mouse #unity
ADD COMMENT
Topic
Name
5+1 =