linerenderer follow camera unity 1

linerenderer follow camera unity

You can render the line using a dedicated camera. Use .depth to control the order in which cameras render (i.e. render the line on top of -everything-), and .cullingMask to define what each camera renders (or not).

http://unity3d.com/support/documentation/ScriptReference/Camera-depth.html

http://unity3d.com/support/documentation/ScriptReference/Camera-cullingMask.html

Here is what the above code is Doing:
1. Create a new camera, and set it to render only the layer “Line”.
2. Create a new game object, and set it to the layer “Line”.
3. Add a LineRenderer component to the game object.
4. Set the LineRenderer’s material to the material “lineMaterial”.
5. Set the LineRenderer’s width to 0.1.
6. Set the LineRenderer’s number of points to 2.
7. Set the LineRenderer’s first point to (0,0,0).
8. Set the LineRenderer’s second point to (0,0,1).

Similar Posts