Class CameraSetup
The camera of a SceneSetup: its projection, where it starts, and whether it gets the camera controller. Built through Perspective(Vector3?, Vector3?) or Orthographic(Vector3?, Vector3?, float?), then WithController(ScreenAnchor?, bool).
public sealed record CameraSetup : IEquatable<CameraSetup>
- Inheritance
-
CameraSetup
- Implements
Constructors
CameraSetup(CameraProjectionMode, Vector3, Vector3, bool, string, ScreenAnchor?, float?, bool)
The camera of a SceneSetup: its projection, where it starts, and whether it gets the camera controller. Built through Perspective(Vector3?, Vector3?) or Orthographic(Vector3?, Vector3?, float?), then WithController(ScreenAnchor?, bool).
public CameraSetup(CameraProjectionMode Projection, Vector3 Position, Vector3 Rotation, bool Controller = false, string Name = "Main", ScreenAnchor? HelpPosition = null, float? OrthographicSize = null, bool ShowHelp = true)
Parameters
ProjectionCameraProjectionModePerspective or orthographic.
PositionVector3The initial position.
RotationVector3The initial rotation in degrees, packed as
X = Yaw,Y = Pitch,Z = Roll- the same convention Add3DCamera(IGame, string?, Vector3?, Vector3?, CameraProjectionMode) uses for itsinitialRotation, and the order the camera controller's F2 panel prints.ControllerboolWhether the camera controller is added, after the camera is aimed, so its reset pose is the aimed one.
NamestringThe entity name, which GetCameraEntity(IGame, string?) finds it by.
HelpPositionScreenAnchor?Where the 3D controller's key help goes, or null for the overlay's own anchor.
OrthographicSizefloat?The height of the view in world units for an orthographic camera, or null for the engine's default of 10.
ShowHelpboolWhether the 3D controller puts its key help on the overlay at all.
Properties
Controller
Whether the camera controller is added, after the camera is aimed, so its reset pose is the aimed one.
public bool Controller { get; init; }
Property Value
HelpPosition
Where the 3D controller's key help goes, or null for the overlay's own anchor.
public ScreenAnchor? HelpPosition { get; init; }
Property Value
Name
The entity name, which GetCameraEntity(IGame, string?) finds it by.
public string Name { get; init; }
Property Value
OrthographicSize
The height of the view in world units for an orthographic camera, or null for the engine's default of 10.
public float? OrthographicSize { get; init; }
Property Value
Position
The initial position.
public Vector3 Position { get; init; }
Property Value
Projection
Perspective or orthographic.
public CameraProjectionMode Projection { get; init; }
Property Value
Rotation
The initial rotation in degrees, packed as X = Yaw, Y = Pitch, Z = Roll - the same convention
Add3DCamera(IGame, string?, Vector3?, Vector3?, CameraProjectionMode) uses for its initialRotation, and the order the camera controller's F2 panel prints.
public Vector3 Rotation { get; init; }
Property Value
ShowHelp
Whether the 3D controller puts its key help on the overlay at all.
public bool ShowHelp { get; init; }
Property Value
Methods
Orthographic(Vector3?, Vector3?, float?)
An orthographic camera, at Initial2DPosition looking down Z unless told otherwise.
public static CameraSetup Orthographic(Vector3? position = null, Vector3? rotation = null, float? orthographicSize = null)
Parameters
positionVector3?The initial position, or null for Initial2DPosition.
rotationVector3?The initial rotation in degrees,
X = Yaw,Y = Pitch,Z = Roll, or null for Initial2DRotation.orthographicSizefloat?The height of the view in world units, or null for the engine's default of 10.
Returns
Perspective(Vector3?, Vector3?)
A perspective camera, at Initial3DPosition looking at the origin unless told otherwise.
public static CameraSetup Perspective(Vector3? position = null, Vector3? rotation = null)
Parameters
positionVector3?The initial position, or null for Initial3DPosition.
rotationVector3?The initial rotation in degrees,
X = Yaw,Y = Pitch,Z = Roll, or null for Initial3DRotation.
Returns
WithController(ScreenAnchor?, bool)
The same camera with the controller: the 3D one for a perspective camera, the 2D one for an orthographic camera.
public CameraSetup WithController(ScreenAnchor? helpPosition = null, bool showHelp = true)
Parameters
helpPositionScreenAnchor?Where the 3D controller's key help goes; null leaves the overlay's own anchor.
showHelpboolfalse keeps the 3D controller but puts no key help on the overlay.