CameraFollowComponent class

Marks an entity as a camera follow target.

Used by CameraFollowSystem to drive the camera toward this entity's TransformComponent position each frame.

world.addComponent(player, CameraFollowComponent());
world.addComponent(player, CameraFollowComponent(
  lookaheadDistance: 120,
  deadZoneWidth: 20,
  deadZoneHeight: 15,
));

When multiple entities carry a CameraFollowComponent, CameraFollowSystem picks the one with the lowest priority value as the single follow target. If two or more entities share the same lowest priority the system switches to multi-target mode and zooms to fit all of them.

Inheritance

Constructors

CameraFollowComponent({bool enabled = true, double lookaheadDistance = 80.0, double deadZoneWidth = 0.0, double deadZoneHeight = 0.0, int priority = 0})

Properties

componentType Type
Type identifier for this component
no setterinherited
deadZoneHeight double
Vertical half-extents of the dead zone (world units).
getter/setter pair
deadZoneWidth double
Horizontal half-extents of the dead zone (world units).
getter/setter pair
enabled bool
Whether this component is active.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
lookaheadDistance double
Lookahead distance (world units) in the entity's movement direction.
getter/setter pair
priority int
Lower values take precedence; entities with the same lowest priority trigger multi-target mode.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onAttach(EntityId entityId) → void
Called when this component is added to an entity.
inherited
onDetach(EntityId entityId) → void
Called when this component is removed from an entity.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited