public void updateNodeLabelPositions()
{
if (Visible)
{
foreach (LogEntry entry in logEntries)
{
Vector3 screenPos = FlightCamera.fetch.cameras[0].WorldToViewportPoint(entry.unityPos);
//check if screenpos xy is valid and in front of the camera (z)
if (screenPos.z > 0
&& screenPos.x >= 0 && screenPos.x <= 1
&& screenPos.y >= 0 && screenPos.y <= 1)
{
entry.guiLabel.enabled = true;
}
else
{
entry.guiLabel.enabled = false;
continue;
}
//also hide gui label if out of viewport x-y
//Debug.Log("LogEntry Label at " + screenPos);
entry.guiLabel.transform.position = screenPos;
}
}
}