The Orthogonal setting controls whether the camera is using a perspective or orthogonal view. The following describes some differences between the two modes:
|Moving objects further from the camera does not change their visible size||Moving objects further from the camera makes them appear smaller|
|Moving the Camera forward and backward does not create a “zoom” effect||Moving the Camera forward and backward does create a “zoom” effect|
|The camera uses the OrthogonalHeight and OrthogonalWidth properties to control the visible area.||The camera uses the FieldOfView property to control the visible area.|
When the camera is in Orthogonal mode, the Z value of objects still impacts drawing order, or whether the objects are drawn at all. If the camera is unrotated, objects with Z values which place them further from the Camera (negative Z in FlatRedBall XNA) will be overlapped by objects which have Z values placing them closer to the Camera. Keep in mind that it is possible to set an objects’ Z such that it is behind the Camera. In this case it will not be visible.
The easiest way to change the Orthogonal value is to change the camera settings in Glue. By default, FlatRedBall projects set the Orthogonal value to true using the Is2D value.
2D vs. 3D Object Size
By default the 2D camera in FlatRedBall will make objects such as sprites appear the same size on screen as the source texture. For example, the following screenshot shows the FlatRedBall icon (which is 85×88 pixels) drawn in a project with a default 2D camera:
Changing the Is 2D value will result in the camera being 3D, drastically changing the size of the icon on screen:
This occurs because the size of the object now depends both on its Width and Height values, as well as the Z value of the camera. By default, the main camera has a Z value of 40. This can be changed in code. Increasing the Z value makes the camera move “backward”, which allows it to see more of the sprite.
Camera.Main.Z = 500;
A 3D camera can be positioned so that objects at Z=0 appear the same size as on a 2D camera using GetZDistanceForPixelPerfect .
Camera.Main.Z = Camera.Main.GetZDistanceForPixelPerfect();
Zooming in Orthogonal Mode
For information on Zooming, see the OrthogonalWidth and OrthogonalHeight entries.