Answers for "raycast unity mouse position"

C#
5

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");
}
Posted by: Guest on July-08-2021

C# Answers by Framework

Browse Popular Code Answers by Language