Anyone spent a lot of time playing with LineRenderer in a 3D game? I’m currently exploring using it for a jump mechanic, where a character can “charge up” a jump, and the LineRenderer is used to show the jump arc prior to actually making the jump.
In my experimentation so far, LineRenderer feels very 2D. In 3D space, it seems to want to use what amounts to a billboard but it does some pretty wacky twisting and things as you pan around to different 3D orientations (the billboard twists around the center point as it moves from point to point of the line render). It kind of works okay if you make the width really thin so the odd twisting behavior is barely noticeable.
Anyone played around with drawing temporary lines or arcs in 3D space and have a technique to recommend? A way to use LineRenderer, or perhaps not using LineRenderer but using some other technique?
If you want to see what I’m talking about, I could post some screenshots or maybe even link a video.
Here’s some code. In this, I have the widths set really small to make it look more like a line instead of s a twisting plane. Also, in the editor, I’ve got the material set to Sprites-Default and alignment as TransformZ. Perhaps with careful creation of material I can achieve a better appearance:
this.lineRenderer.startWidth = 0.03f;
this.lineRenderer.endWidth = 0.02f;
this.lineRenderer.positionCount = points.Count;
this.lineRenderer.SetPositions(points.ToArray());
Here’s an image; I’ve used a gradient and some alpha to help show kind of what it is doing (also increased widths to 0.5 for the image; it looks more like just a line using the much smaller 0.03 and 0.02 numbers).