Table of Contents

Class Basic3DCameraController

Namespace
Stride.CommunityToolkit.Scripts
Assembly
Stride.CommunityToolkit.dll

A script that allows to move and rotate an entity through keyboard, mouse and touch input to provide basic camera navigation.

public class Basic3DCameraController : SyncScript, IIdentifiable, ICollectorHolder
Inheritance
Basic3DCameraController
Implements
Inherited Members
Extension Methods

Remarks

The entity can be moved using W, A, S, D, Q and E, arrow keys, a gamepad's left stick or dragging/scaling using multi-touch. Rotation is achieved using the Numpad, the mouse while holding the right mouse button, a gamepad's right stick, or dragging using single-touch.

This functionality is inspired by Stride.Assets.Presentation, Assets->Scripts->Camera

Constructors

Basic3DCameraController()

Initializes a new instance of the Basic3DCameraController class.

public Basic3DCameraController()

Basic3DCameraController(DisplayPosition)

Initializes a new instance of the Basic3DCameraController class with the specified display position.

public Basic3DCameraController(DisplayPosition displayPosition = DisplayPosition.TopRight)

Parameters

displayPosition DisplayPosition

The position on the screen where the camera controls will be displayed. Defaults to TopRight.

Properties

Gamepad

Enables gamepad input when true.

public bool Gamepad { get; set; }

Property Value

bool

KeyboardMovementSpeed

Base translation speed (units/second) for keyboard navigation.

public Vector3 KeyboardMovementSpeed { get; set; }

Property Value

Vector3

KeyboardRotationSpeed

Rotation speed for keyboard / gamepad discrete rotation.

public Vector2 KeyboardRotationSpeed { get; set; }

Property Value

Vector2

MouseRotationSpeed

Sensitivity for mouse-driven yaw/pitch adjustments.

public Vector2 MouseRotationSpeed { get; set; }

Property Value

Vector2

SpeedFactor

Multiplier applied when sprint modifier (shift / pad buttons) is active.

public float SpeedFactor { get; set; }

Property Value

float

TouchMovementSpeed

Translation speed scaling for touch gestures (XY, Z).

public Vector3 TouchMovementSpeed { get; set; }

Property Value

Vector3

TouchRotationSpeed

Sensitivity for touch drag rotation (yaw, pitch).

public Vector2 TouchRotationSpeed { get; set; }

Property Value

Vector2

Methods

Start()

Initializes help overlay, caches default transform and configures gesture recognizers.

public override void Start()

Update()

Per-frame update: processes input and applies translation/rotation.

public override void Update()