I have a simple scene where a camera can orbit around a sphere gameobject and would like to draw a small cursor texture wherever a raycast shot forward from the camera hits the spheres surface. I’m new to textures in general so i don’t know how to implement it.
See attached image for a better picture.
void DrawCursor()
{
RaycastHit hit;
Ray ray = new Ray (camera.transform.position, camera.transform.forward);
if (Physics.Raycast (ray, out hit, distance))
{
if (hit.collider.tag == "World")
{
Debug.DrawRay (camera.transform.position, camera.transform.forward, Color.red);
}
}
}
