It's nice to know what our destination will be set to before we click the mouse. So, let's add a yellow sphere to show the "candidate" destination for where our raycast is hitting a surface, updating each frame as we move the mouse.
So, we need to create a second, yellow sphere. We also need to create a Layer to ignore; otherwise, if we move the yellow sphere to the point where a raycast hits a surface, then in the next frame, our raycast will hit the surface of our yellow sphere – moving it closer and closer to us each frame!
To improve the UX by updating a "gaze" cursor each frame, do the following:
- Create a new yellow Material object named m_yellow.
- Create a second 3D Sphere named Sphere-destination-candidate that's textured with m_yellow.
- Create a new Layer called UISpheres.
- Set this Layer for both the Sphere-destination and Sphere-destination...