CameraComponent class Scene graph

An engine Component that places a Camera in the scene.

The camera's view (eye position and orientation) comes from the owning node's world transform: the node's translation is the eye, its local +Z axis is the look direction, and its local +Y axis is up. The projection (the lens) is configured on the component. Move or rotate the node to move or aim the camera.

Use toCamera to get a Camera backed by the node, suitable for Scene.render or a persistent RenderView. (The node should not be scaled; a camera node is expected to carry only rotation and translation.)

When the owning node is mounted in a scene, the component registers as a candidate for the scene's primary camera (Scene.camera). The first camera mounted becomes the primary automatically; call makeActive to select this one explicitly.

Inheritance

Constructors

CameraComponent({CameraProjection? projection})
Creates a camera component with the given projection (a PerspectiveProjection by default).

Properties

active bool
Whether the scene's primary camera currently resolves to this component.
no setter
enabled bool
Whether this component's update hook runs each frame.
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
isAttached bool
Whether this component is currently attached to a node.
no setterinherited
isLoaded bool
Whether onLoad has completed.
no setterinherited
isMounted bool
Whether the owning node is part of a live scene graph.
no setterinherited
node Node
The node this component is attached to.
no setterinherited
projection CameraProjection
The lens projection for this camera.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

cloneFor(Node cloneOwner) Component?
Returns a copy of this component for cloneOwner, the Node.clone counterpart of the owning node, or null to not carry the component to clones (the default).
inherited
fixedUpdate(double fixedDt) → void
Called once per fixed physics step while the component is mounted, enabled, and loaded. fixedDt is the fixed timestep of the surrounding PhysicsWorld, not the frame interval.
inherited
makeActive() → void
Makes this the scene's primary camera, overriding auto-promotion.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onAttach() → void
Called when this component is added to a node.
inherited
onDetach() → void
Called when this component is removed from a node.
override
onLoad() Future<void>
Optional asynchronous setup, such as loading an asset.
inherited
onMount() → void
Called when the owning node enters a live scene graph.
override
onUnmount() → void
Called when the owning node leaves a live scene graph.
override
toCamera() NodeCamera
Returns a NodeCamera backed by the owning node.
toString() String
A string representation of this object.
inherited
update(double deltaSeconds) → void
Called once per frame while the component is mounted, enabled, and loaded. deltaSeconds is the elapsed time since the previous tick.
inherited

Operators

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