Skip to content

Sein Camera Pawn

Class · ASeinCameraPawn : APawn

#include "Player/SeinCameraPawn.h"

can be subclassed in Blueprint

The default RTS camera. A pivot at the root moves along the ground, a spring arm supplies zoom and pitch, and the camera hangs off the arm. Every tuning value can be changed per Blueprint or per placed instance. It implements Sein Snapshot Camera Provider so saves restore its view; a custom camera pawn opts in by implementing the same interface.

Follow an entity. Set to Invalid to stop following. Auto-disables on manual input.

void FollowEntity(FSeinEntityHandle Entity);

Stop following any entity.

void StopFollowing();

Whether the camera is currently following an entity.

bool IsFollowing() const;

Reset camera rotation to north-facing (yaw = 0).

void ResetRotation();

Recenter the ground focus on a world point: moves the pivot’s XY immediately and lets ground-follow ease Z to the terrain there (smooth altitude transition, no pop). Preserves yaw / pitch / zoom; cancels any active follow. Use for minimap clicks etc. Only WorldPoint.XY is used — Z is resolved by ground-follow.

void FocusOnWorldPoint(FVector WorldPoint);

Get the current camera pivot world location.

FVector GetPivotLocation() const;

Get the current camera yaw in degrees.

float GetCameraYaw() const;

Get the current zoom distance.

float GetCurrentZoomDistance() const;

Get the current camera pitch in degrees.

float GetCameraPitch() const;

Snaps the camera to a pivot location, yaw, pitch and zoom distance in one call, with no easing. Use it to restore a saved view.

void SetCameraState(FVector PivotLocation, float Yaw, float Pitch, float ZoomDistance);

TObjectPtr<USceneComponent> CameraPivot · default CreateDefaultSubobject<USceneComponent>(TEXT("CameraPivot"))

Read-only in Details · Blueprint read-only

Root pivot scene component — moves on the ground plane.

TObjectPtr<USpringArmComponent> SpringArm · default CreateDefaultSubobject<USpringArmComponent>(TEXT("SpringArm"))

Read-only in Details · Blueprint read-only

Spring arm controlling zoom distance and pitch angle.

TObjectPtr<UCameraComponent> CameraComponent · default CreateDefaultSubobject<UCameraComponent>(TEXT("Camera"))

Read-only in Details · Blueprint read-only

Camera component attached to the spring arm.

float PanSpeed · default 2000.0f

Editable in defaults and on instances · Blueprint read and write

Pan speed in units per second (WASD / edge scroll).

bool bEnableEdgeScroll · default true

Editable in defaults and on instances · Blueprint read and write

Enable screen-edge scrolling.

float EdgeScrollMargin · default 20.0f · shown when bEnableEdgeScroll · min 1

Editable in defaults and on instances · Blueprint read and write

Screen edge margin in pixels that triggers edge scroll.

float EdgeScrollSpeedMultiplier · default 1.0f · shown when bEnableEdgeScroll · min 0.0

Editable in defaults and on instances · Blueprint read and write

Edge scroll speed multiplier relative to PanSpeed.

float RotationSpeed · default 90.0f

Editable in defaults and on instances · Blueprint read and write

Keyboard rotation speed in degrees per second at full axis deflection (Q/E).

float ZoomMin · default 500.0f · min 100.0

Editable in defaults and on instances · Blueprint read and write

Minimum zoom distance (closest to ground).

float ZoomMax · default 5000.0f · min 100.0

Editable in defaults and on instances · Blueprint read and write

Maximum zoom distance (farthest from ground).

float ZoomStep · default 200.0f

Editable in defaults and on instances · Blueprint read and write

Zoom step per scroll wheel tick.

float ZoomRate · default 2500.0f

Editable in defaults and on instances · Blueprint read and write

Keyboard zoom speed in world units per second at full axis deflection (Z/X). Frame-rate independent, unlike the per-tick wheel ZoomStep.

float ZoomInterpSpeed · default 10.0f · min 1.0

Editable in defaults and on instances · Blueprint read and write

Zoom interpolation speed (higher = snappier).

float DefaultZoomDistance · default 2000.0f

Editable in defaults and on instances · Blueprint read and write

Default zoom distance at game start.

float CameraPitch · default -50.0f

Editable in defaults and on instances · Blueprint read and write

Default spring arm pitch angle in degrees (negative = looking down).

float PitchMin · default -85.0f · min -89.0, max -5.0

Editable in defaults and on instances · Blueprint read and write

Minimum pitch angle (most top-down, e.g., -85). Must be negative.

float PitchMax · default -5.0f · min -89.0, max -5.0

Editable in defaults and on instances · Blueprint read and write

Maximum pitch angle (most flat/horizontal, e.g., -5). Must be negative.

float OrbitSensitivity · default 0.3f

Editable in defaults and on instances · Blueprint read and write

Mouse rotate sensitivity in degrees per pixel of mouse movement, applied to both yaw (horizontal) and pitch (vertical). Scaled by the player controller’s Mouse Rotate Modifier.

float TiltSpeed · default 45.0f

Editable in defaults and on instances · Blueprint read and write

Keyboard tilt speed in degrees per second at full axis deflection.

bool bEnableBounds · default false

Editable in defaults and on instances · Blueprint read and write

Enable camera movement bounds.

FBox WorldBounds · default FBox(FVector(-10000, -10000, -10000), FVector(10000, 10000, 10000)) · shown when bEnableBounds

Editable in defaults and on instances · Blueprint read and write

World-space bounding box for camera pivot. Only XY is enforced.

bool bGroundFollow · default true

Editable in defaults and on instances · Blueprint read and write

Keep the camera’s ground-focus pivot on the terrain (traced down each tick) so the camera maintains a constant height ABOVE the ground instead of a fixed world Z. The spring arm provides the height; the pivot rides the terrain.

float GroundFollowInterpSpeed · default 8.0f · shown when bGroundFollow · min 0.5

Editable in defaults and on instances · Blueprint read and write

How quickly the pivot’s Z eases toward the traced ground height. Higher = snappier vertical tracking, lower = floatier. Smooths both terrain panning and recenter snaps.

TEnumAsByte<ECollisionChannel> GroundTraceObjectType · default ECC_WorldStatic · shown when bGroundFollow

Editable in defaults and on instances · Blueprint read and write

Object type the downward ground trace queries. WorldStatic = terrain + static meshes, ignoring dynamic units/pawns so the camera doesn’t bob over unit tops.

float GroundTraceExtent · default 100000.0f · shown when bGroundFollow · min 100.0

Editable in defaults and on instances · Blueprint read and write

Half-length (world units) of the up/down ground trace from the pivot. Must clear the tallest terrain feature on the map.

C++ members (7)
  • void HandleMMBPanInput(const FVector2D& MouseDelta); Handle MMB pan input (direct mouse delta, moves pivot). Grab-the-ground style (inverted).
  • void HandleOrbitInput(const FVector2D& MouseDelta); Handle mouse rotate input. X = yaw orbit, Y = pitch tilt (clamped); both axes per-pixel at OrbitSensitivity — no time scaling, a mouse delta already encodes its own magnitude.
  • void HandlePanInput(const FVector2D& AxisValue); Called by the player controller when camera pan input is received.
  • void HandleRotateInput(float YawDelta); Called by the player controller when camera rotate input is received (keyboard Q/E).
  • void HandleTiltInput(float TiltDelta); Called by the player controller when keyboard camera tilt input is received. Adjusts the spring-arm pitch at TiltSpeed degrees/second, clamped to [PitchMin, PitchMax] — the keyboard twin of the orbit input’s Y axis.
  • void HandleZoomInput(float ZoomDelta); Called by the player controller when mouse-wheel zoom input is received. Steps the target distance by ZoomStep per wheel tick (event-scaled).
  • void HandleKeyZoomInput(float ZoomDelta); Called by the player controller when keyboard zoom input is received. Moves the target distance at ZoomRate units/second — the frame-rate- independent twin of the wheel’s per-tick HandleZoomInput.