I can't increase the length of line renderer.

I'm having difficulties with the line renderer. I'm using unity 2018.1.0f2 and there are parameters in the line renderer that do not exist anymore (start length, end length) there is only width now, my issue is that i can't adjust the length on the line renderer and what ends up happening is that it is stopping at a certain range. It's such a strange problem that i don't understand and so i apologize for a poor explanation. I've increased the 'width' property on the line renderer to show it clearly and have increased the speed of the turret fire so the line is constantly displayed. I appreciate the assistance



  • Jonathan Gonzalez(jgonzalez) replied

    I'll have to take a look at the updated changes to the component. Nonetheless the "length" of the line renderer is based off the raycast hitting an object. The line is rendered using vector3 points (position). So the starting point of the line would be at the front of the weapon, the end point would be a straight line to whatever we hit like the enemies or even a wall. We detect that hit using the raycast. So the raycast hit point is the second position that we use for the line renderer. Taking those two points it renders a line between them.  

  • Jonathan Gonzalez(jgonzalez) replied

    I tried the line renderer in Unity 2018 and it looks to be the same. The positions can be adjusted if you wanted to manually adjust the length. I've included a few images to show you how it would be done:

    This first image has the line renderer with the "z" value of the "Element 1" set to 1. We can see the line renderer's length is 1 along the Z axis (blue arrow). If I increase that value to 5 it'll lengthen it:

    Here it is at a value of 5. Note that the X and Y of both of these are set to 0. Also the values in Element 0 are also set to 0 across each axis. If I wanted to move the line renderer up or to the side I would adjust the X or Y values accordingly. Hope that helps to shed some light on how to use it for length. 

  • Roman Ozerski(romanozerski) replied

    I've just discovered why and i'm kicking myself. The explanation above makes sense to me and the problem was that the line was intersecting with the pole in front of the cube. I feel so dumb but thanks for helping me.

  • Jonathan Gonzalez(jgonzalez) replied

    No worries, glad I could clarify that for you!