- Home /
Making Spotlight rotate on fixed axis
I have the cursor indicate where the spotlight should be pointing. Below is function I have achieving this. However Im wanting to tweak this, Im wanting to have the light rotate around my character and not change how close or far the spotlight is looking at, instead of following the exact point where the cursor is in world coordinates. any help is greatly appreciated.
public void lineMouse()
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if(Physics.Raycast(ray, out hit))
{
this.transform.LookAt(hit.point);
}
}
Comment
Your answer