ThirdPersonControllerComponent class Gameplay kit

High-level 3rd-person character movement component with ground raycast snapping, slope sliding, coyote time, and turn smoothing.

For physical character navigation against 3D colliders and capsules with autostep, see KinematicCharacterController in package:flutter_scene/physics.dart.

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

ThirdPersonControllerComponent({double walkSpeed = 4.5, double runMultiplier = 1.8, double turnSpeed = 12.0, double jumpVelocity = 6.5, double gravity = 18.0, double maxSlopeAngleDegrees = 45.0, double coyoteTimeWindow = 0.12, double jumpBufferWindow = 0.15, double landingJumpDelay = 0.20, int groundLayerMask = 0xFFFFFFFF, double? groundPlaneHeight, double footOffset = 0.0, double obstacleRadius = 0.85, double obstacleHeight = 1.8})

Properties

coyoteTimeWindow double
Time window (in seconds) after leaving a ledge during which a jump is still allowed.
getter/setter pair
enabled bool
Whether this component's update hook runs each frame.
getter/setter pairinherited
footOffset double
Vertical offset from the node origin down to the character's feet.
getter/setter pair
gravity double
Downward gravitational acceleration.
getter/setter pair
groundLayerMask int
Layer mask used for raycasting against static floor/ground geometry.
getter/setter pair
groundNormal ↔ Vector3
Ground surface normal beneath the character.
getter/setter pair
groundPlaneHeight double?
Optional fallback infinite planar floor height.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
isAttached bool
Whether this component is currently attached to a node.
no setterinherited
isGrounded bool
Whether the character is currently touching the ground.
getter/setter pair
isLoaded bool
Whether onLoad has completed.
no setterinherited
isMounted bool
Whether the owning node is part of a live scene graph.
no setterinherited
jumpBufferWindow double
Time window (in seconds) /// Time buffer window for jump inputs before landing (in seconds).
getter/setter pair
jumpVelocity double
Upward velocity impulse applied on jump.
getter/setter pair
landingJumpDelay double
Delay after landing before another jump can be initiated (in seconds).
getter/setter pair
maxSlopeAngleDegrees double
Maximum slope angle (in degrees) that can be walked up without sliding.
getter/setter pair
node Node
The node this component is attached to.
no setterinherited
obstacleHeight double
Total capsule height for vertical obstacle collision scanning.
getter/setter pair
obstacleRadius double
Capsule/cylinder radius for horizontal obstacle collision. Set to 0 to disable.
getter/setter pair
runMultiplier double
Multiplier applied when sprinting.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
turnSpeed double
Speed at which the character turns to face the movement direction (rad/s).
getter/setter pair
velocity ↔ Vector3
Current linear velocity vector in world space.
getter/setter pair
walkSpeed double
Base walking speed in world units per second.
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.
override
jump() → void
Triggers a jump request (buffered if in mid-air).
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.
inherited
onUnmount() → void
Called when the owning node leaves a live scene graph.
inherited
setMoveInput(Vector2 input, {bool isRunning = false, double? cameraHeadingYaw}) → void
Feeds planar movement input vector (-1.0 to 1.0 on X/Y, where +Y is forward) and optional cameraHeadingYaw angle (in radians) so movement is relative to camera view.
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