# Check the length of a line renderer?

I created a script that makes a line renderer in the 3d world space…

for example,

(these are the positions of the line renderer)

``````position 1 : 50x, 80y, 0z
position 2 : 80x, 120y, 0z
``````

is it possible to calculate the LENGTH of the line renderer as a float?
for example : line renderer = 156.7 units…

P.S. THE REASON I am having trouble finding the length of the line renderer
is because there are both x AND y values, if it was just X values, I could for example say… that the length is 30 units/pixels (using the example positions above)
BUT since there are two values, the line renderer is diagonal…making it hard to find the length!

EDIT : Im just trying to convert the Vector positions into a float value.

Say position1 and position2 are Vector3 variables. You get the length by:

`````` var length = (position2 - position1).magnitude;
``````

The Vector3 class has a method to calculate the distance of two vector3 :

`````` float _Distance = Vector3.Distance(Position1,Position2);
``````