public void tryAddWaypoint(RecordingThresholds thresholds)
{
//Debug.Log("Track.addWaypoint");
//Debug.Log("TrackDump: + " + serialized());
Waypoint newNode = new Waypoint(SourceVessel);
//only record if vessel is moving
if (!sufficientChange(newNode, thresholds))
return;
//Vector3 velocity = SourceVessel.rigidbody.velocity;
//Quaternion orientation = SourceVessel.rigidbody.rotation;
//Debug.Log("adding waypoint to list");
waypoints.Add(newNode);
Modified = true;
//add new point to renderer
if (Visible && waypoints.Count % SamplingFactor == 0){
int index = waypoints.Count / SamplingFactor - 1;
lineRenderer.SetVertexCount(index + 1);
Vector3 currentPos = this.referenceBody.GetWorldSurfacePosition(SourceVessel.latitude, SourceVessel.longitude, SourceVessel.altitude);
lineRenderer.SetPosition(index, currentPos);
//mapLineRenderer.SetVertexCount(index + 1);
//mapLineRenderer.SetPosition(index, ScaledSpace.LocalToScaledSpace(currentPos));
//this.renderCoords.Add(currentPos);
}
//Debug.Log("done");
}