Quantcast
Viewing all articles
Browse latest Browse all 60

Answer by Narv

I assume you want the spotlight to follow your mouse cursor on the floor or ground, correct? if so, look up the function ScreenPointToRay() in Camera.. also Physics.Raycast. You will get a ray from ScreenPointToRay and then do a raycast and find the RaycastHit point and then that would be the point in world space that the spotlight would shine . Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if(Physics.Raycast(ray, out hit) { // make the spotlight do whatever using hit.point }

Viewing all articles
Browse latest Browse all 60

Trending Articles