private void Update() { target.GetLinkVertexData(ref linkVerts); if (numVerts != linkVerts.Length / 6) { numVerts = linkVerts.Length / 6 + 1; line.positionCount = numVerts; } if (linkVerts.Length > 0) { tempVector3.Set(linkVerts[0], linkVerts[1], linkVerts[2]); //link verts are in pairs marking the ends of the links. line.SetPosition(0, tempVector3); for (index = 0; index < numVerts - 1; index++) { idx = (index * 2 + 1) * 3; tempVector3.Set(linkVerts[idx], linkVerts[idx + 1], linkVerts[idx + 2]); line.SetPosition(index + 1, tempVector3); } } }
void Update() { target.GetLinkVertexData(ref nodes); if (numVerts != target.Nodes.Count) { numVerts = target.Nodes.Count; line.SetVertexCount(numVerts); } line.SetPosition(0, nodes[0].ToUnity()); for (int i = 0; i < numVerts - 1; i++) { line.SetPosition(i + 1, nodes[i * 2 + 1].ToUnity()); } }
void Update() { target.GetLinkVertexData(ref linkVerts); if (numVerts != linkVerts.Length / (3 * 2)) { numVerts = linkVerts.Length / (3 * 2) + 1; line.SetVertexCount(numVerts); } if (linkVerts.Length > 0) { //link verts are in pairs marking the ends of the links. line.SetPosition(0, linkVerts[0].ToUnity()); for (int i = 0; i < numVerts - 1; i++) { int idx = (i * 2 + 1); line.SetPosition(i + 1, linkVerts[idx].ToUnity()); } } }
void Update() { target.GetLinkVertexData(ref linkVerts); if (numVerts != linkVerts.Length / (3 * 2)) { numVerts = linkVerts.Length / (3 * 2) + 1; line.positionCount = numVerts; } if (linkVerts.Length > 0) { //link verts are in pairs marking the ends of the links. line.SetPosition(0, new Vector3(linkVerts[0], linkVerts[1], linkVerts[2])); for (int i = 0; i < numVerts - 1; i++) { int idx = (i * 2 + 1) * 3; line.SetPosition(i + 1, new Vector3(linkVerts[idx], linkVerts[idx + 1], linkVerts[idx + 2])); } } }