Although I have my galaxy simulation working reasonably well, I was adding some functionality to switch the view to look at it face-on and edge-on.
the face-on works as expected.
public void OrientToFace()
{
cameraNode.Position = new Vector3(0, 0, 160000);
cameraNode.LookAt(new Vector3(0, 0, 0), Vector3.Up, TransformSpace.Parent);
}
In the face-on view, the Sun is to the left of the galactic core
However, the edge-on face is flipping something around so the Sun is to the right.
public void OrientToEdge()
{
cameraNode.Position = new Vector3(0, 160000, 0);
cameraNode.LookAt(new Vector3(0, 0, 0), Vector3.Up, TransformSpace.Parent);
}
What is strange is if I set the z coordinate of the camera to something like 200 rather than 0 (so I’m not exactly edge-on) then the Sun is on the left as expected. However setting z to anything between 100 (approx.) and 0 causes the flipped view to be shown.
Note: Vector3.Up is (0, 1, 0)
Anyone have any thoughts on what is going on here?