Table of Contents

Class CameraSetup

Namespace
Stride.CommunityToolkit.Engine
Assembly
Stride.CommunityToolkit.dll

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

Projection CameraProjectionMode

Perspective or orthographic.

Position Vector3

The initial position.

Rotation Vector3

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.

Controller bool

Whether the camera controller is added, after the camera is aimed, so its reset pose is the aimed one.

Name string

The entity name, which GetCameraEntity(IGame, string?) finds it by.

HelpPosition ScreenAnchor?

Where the 3D controller's key help goes, or null for the overlay's own anchor.

OrthographicSize float?

The height of the view in world units for an orthographic camera, or null for the engine's default of 10.

ShowHelp bool

Whether 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

bool

HelpPosition

Where the 3D controller's key help goes, or null for the overlay's own anchor.

public ScreenAnchor? HelpPosition { get; init; }

Property Value

ScreenAnchor?

Name

The entity name, which GetCameraEntity(IGame, string?) finds it by.

public string Name { get; init; }

Property Value

string

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

float?

Position

The initial position.

public Vector3 Position { get; init; }

Property Value

Vector3

Projection

Perspective or orthographic.

public CameraProjectionMode Projection { get; init; }

Property Value

CameraProjectionMode

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

Vector3

ShowHelp

Whether the 3D controller puts its key help on the overlay at all.

public bool ShowHelp { get; init; }

Property Value

bool

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

position Vector3?

The initial position, or null for Initial2DPosition.

rotation Vector3?

The initial rotation in degrees, X = Yaw, Y = Pitch, Z = Roll, or null for Initial2DRotation.

orthographicSize float?

The height of the view in world units, or null for the engine's default of 10.

Returns

CameraSetup

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

position Vector3?

The initial position, or null for Initial3DPosition.

rotation Vector3?

The initial rotation in degrees, X = Yaw, Y = Pitch, Z = Roll, or null for Initial3DRotation.

Returns

CameraSetup

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

helpPosition ScreenAnchor?

Where the 3D controller's key help goes; null leaves the overlay's own anchor.

showHelp bool

false keeps the 3D controller but puts no key help on the overlay.

Returns

CameraSetup