Skip to content

CameraFollowComponent Class

Definition

Namespace: Brine2D.Systems.Rendering

Component that makes a camera follow this entity. Used by CameraSystem to control camera position.

public class CameraFollowComponent : Brine2D.ECS.Component

Inheritance System.ObjectComponent → CameraFollowComponent

Properties
CameraName Name of the camera to control (default: MainCameraName). Allows different entities to control different cameras (e.g., minimap, split-screen).
Deadzone Deadzone (camera won't move if entity is within this distance from center). When the entity exits the deadzone, the camera follows to maintain the entity at the deadzone edge rather than snapping directly to the entity's position. Both components must be non-negative.
FollowX Whether to follow on X axis.
FollowY Whether to follow on Y axis.
IsActive Whether this component participates in camera follow selection. When multiple entities are active for the same camera, the one with the highest Priority wins.
Offset Offset from entity position in world space.
Priority Priority (higher priority targets override lower ones if multiple are active for same camera).
Smoothing Follow speed. Higher = snappier. 0 = instant snap. Typical values: 2 (dreamy), 5 (responsive), 15 (tight), 0 (instant). Frame-rate independent.
TargetZoom Target zoom level. When set, the camera smoothly adjusts zoom using ZoomSmoothing. When null (default), zoom is not controlled by this component.
WorldBounds Optional world boundaries to clamp the camera within after following. When set, CameraSystem calls ClampToBounds(Rectangle) each frame.
ZoomSmoothing Zoom smoothing speed. Higher = snappier. 0 = instant snap. Typical values: 2 (dreamy), 5 (responsive), 15 (tight), 0 (instant). Frame-rate independent. Only applied when TargetZoom is set.