- Home /
Find (Get) linerenderer vertex positions
How can find the value of linerenderer vertex position? There is a SetPosition() function to edit a value, but no GetPosition()function that just returns the current value.
I want to make an existing line longer: a cable lowering an object. The cable has a start distance set in the inspector.
Answer by Bluestrike · Oct 31, 2012 at 10:52 AM
Created a variable that i manually set to hold the same value as the value in the inspector. And add the movement distance to that value to find the final value I need.
Can you tell us exactly how you did that??? i'm kind of new... and i didnt get how you stored all values in variable and then access them... actually how do we store when we are unable to access it?? It will be great help if you explain us...
Answer by XienDev · Oct 30, 2012 at 04:18 PM
Create a List; and add there your positions, after you can acess it like an array:
using System.Collections.Generic;
...
public List<Vector3> lineRendererVertexes;
....
lineRendererVertexes = new List<Vector3>();
....
lineRendererVertexes.Add(newPosition);
....
for( int i = 0; i < lineRendererVertexes.Count; i++)
{
lineRendererVertexes[i] ....
}