SpringArmComponent class Gameplay kit

A camera boom component that maintains distance to a target while preventing geometry occlusion by raycasting against the environment.

For a full-featured orbit camera controller with mouse/touch drag and inertial damping, see FollowCameraController and OrbitCameraController.

Note on raycasting: raycastNode performs a hierarchical bounding-box early-out followed by per-triangle intersection tests on static render meshes at rest pose.

Inheritance

Constructors

SpringArmComponent({double targetLength = 4.0, double probeRadius = 0.2, Vector3? targetOffset, Vector3? socketOffset, bool enablePositionLag = false, double positionLagSpeed = 10.0, double minLength = 0.5, int layerMask = 0xFFFFFFFF, Node? cameraNode, bool inheritYaw = true, bool inheritPitch = true, double yaw = 0.0, double pitch = 0.0})

Properties

cameraNode Node?
An optional child camera node driven directly by this spring arm.
getter/setter pair
currentLength double
Current actual length of the boom after occlusion and smoothing.
getter/setter pair
effectivePitch double
Effective pitch angle of the boom.
no setter
effectiveYaw double
Effective yaw angle of the boom.
no setter
enabled bool
Whether this component's update hook runs each frame.
getter/setter pairinherited
enablePositionLag bool
Whether the boom position smoothly lags behind the target.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
inheritPitch bool
Whether to inherit pitch rotation from the owning node.
getter/setter pair
inheritYaw bool
Whether to inherit yaw rotation from the owning node.
getter/setter pair
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
layerMask int
Bitmask of layers to test for occlusion (defaults to all layers).
getter/setter pair
minLength double
Minimum distance the arm can compress to when obstructed.
getter/setter pair
node Node
The node this component is attached to.
no setterinherited
pitch double
Boom pitch angle in radians (used when inheritPitch is false).
getter/setter pair
positionLagSpeed double
Speed at which the lagged position catches up to the target (higher = faster).
getter/setter pair
probeRadius double
Radius of the sphere probe used to test for obstacles (0.0 for a thin ray).
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
socketOffset ↔ Vector3
Local offset applied at the camera socket end along socket right (X) and up (Y).
getter/setter pair
socketTransform → Matrix4
Gets the world-space socket transform computed for this frame.
no setter
targetLength double
Desired length of the boom arm when unoccluded.
getter/setter pair
targetOffset ↔ Vector3
Local offset applied along world axes from the owning node's origin to the boom's pivot.
getter/setter pair
yaw double
Boom yaw angle in radians (used when inheritYaw is false).
getter/setter pair

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).
override
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
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.
inherited
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.
inherited
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. A traversal visits each component at most once. Removing this component or an earlier sibling is safe. A component inserted before the current traversal position starts on the next frame. Reordering component or child lists during traversal is unsupported.
override

Operators

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