- Home /
Raycast trail renderer?
Hi, are there any ways i can make my raycast path clearly visible,, with some sort of lines or trails, without using a solid object with a trail renderer? Thanks?
Answer by Loius · Nov 30, 2010 at 03:43 AM
You might try a Line Renderer, since you can directly set its points without having something move like Trail; if that's not sufficient you may have/want to dynamically create a mesh.
erm,how do i make a line renderer using a raycast ray? thats exactly what my problem is
You have a line renderer which you've added in the project or one you've just created, and you just set its position. url=http://unity3d.com/support/documentation/ScriptReference/LineRenderer.html
Answer by azzogat · Nov 30, 2010 at 09:20 AM
You can use the debug draw line function with the raycast start and hit (or end) point.
Or you could use the line renderer (as was earlier stated) by saving the raycast start position Vector and the end vector and using those with the line renderer setposition 0,1.
You could also place an empty gameobject at the raycast starting position and one at the hit(or end point). You should then use those two empty GOs as the start and end position for the line renderer. (this is an excercise in futility but it would help you visualize the positions)
Answer by TowerOfBricks · Dec 01, 2010 at 02:55 PM
If you have Pro you can also use the GL.Draw functions, this will make the lines visible outside the editor too.
I don't have pro myself though so I haven't tested them.