Hi,
the title says it:
I have x,y,z coordinates in an Array like
var track : Vector3[ ] = new Vector3[max]
In Scene view I can use: Debug.DrawLine (track~~, track[s+1], Color.red, 100); in a FOR…~~
But I also want to see the line in the Game View.
Can someone give me a tipp?
Your message is not really clear.
But you should try to use a line renderer , that could do the trick
I have all my x,y,z coordinates in the game view, say maybe a GPS Track with x,z in Meters and the hight is y. And I wanna draw a line or something else through this coordinates, not a spline, only a line from one coordinate to the next, like the screenshot i attached in the first post = blue line.
The red dots should say that I have the x,y,z coordinates in an ARRAY.
So how can I controll the lineRenderer via script?
And which object should have the linerenderer? Another cube? or the same object with that I read the xyz coordinates?
I try this out, but I get this message:
LineRenderer.SetPosition index out of bounds!
var lineRenderer : LineRenderer = GetComponent(LineRenderer);
for(var iii : int = 0; iii < Max_GPS_Datensaetze+1; iii++) {
var pos : Vector3 = Vector3(GPS_daten[iii].x,GPS_daten[iii].y,GPS_daten[iii].z);
lineRenderer.SetPosition(iii, pos);
}
I cannot figuered out why…
I think you need to set the number of element for your lineRenderer
try :http://docs.unity3d.com/Documentation/ScriptReference/LineRenderer.SetVertexC
ount.html
lineRenderer.SetVertexCount(lengthOfYourArray);
brilliant, thanks, thats what i forget…
many thanks…
You are welcome ( de rien ^^)