float GetDistance(MeasurementLine lineData) //Returns distance from an entry of lineData { Vector3 globalStart = lineData.StartLocation + FindGlobalPos(lineData.StartTag); Vector3 globalEnd = lineData.EndLocation + FindGlobalPos(lineData.EndTag); return(Vector3.Distance(globalStart, globalEnd)); }
void DrawLine(MeasurementLine lineData) { GameObject lineObject = new GameObject(); LineRenderer line = lineObject.AddComponent <LineRenderer>(); SetLineProperties(line); line.SetPosition(0, (FindGlobalRotation(lineData.StartTag) * lineData.StartLocation) + FindGlobalPos(lineData.StartTag)); //adds the local position of the line to the global position of the relevant object line.SetPosition(1, (FindGlobalRotation(lineData.EndTag) * lineData.EndLocation) + FindGlobalPos(lineData.EndTag)); line.name = lineData.Layer.ToString(); lineObjects.Add(lineObject); }