Table of Contents

Class Basic2DCameraController

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

Provides an interactive 2D camera controller for navigating 2D scenes in Stride. This controller supports movement in the XY-plane using keyboard inputs (W, A, S, D, arrow keys), zooming in and out with the mouse wheel, and moving the camera based on mouse position near screen edges. Additional features include a speed boost when holding shift and the ability to reset the camera to a default position and zoom level using the 'H' key.

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

Remarks

  • The camera moves at a default speed which can be increased with shift keys.
  • Zooming is performed by changing the OrthographicSize of the camera.
  • The camera can be moved towards the edges of the screen when the mouse cursor is close to them.
  • The 'H' key resets the camera to its default position and orthographic size.
  • Default settings: FarClipPlane=1000, NearClipPlane=0.1f, OrthographicSize=10.

Methods

Start()

Called before the script enters it's update loop.

public override void Start()

Update()

Called every frame.

public override void Update()