KinematicCharacterController class Physics
Kinematic move-and-slide against the world's colliders.
Attach beside a Collider describing the character's volume; the backend must support characters (UnsupportedError otherwise). Call move once per fixed step; the corrected translation is applied to the node and returned.
Constructors
- KinematicCharacterController({Vector3? up, double offset = 0.01, bool slide = true, double maxSlopeClimbAngle = pi / 4, double minSlopeSlideAngle = pi / 4, double? snapToGround = 0.1, bool autostep = false, double autostepMaxHeight = 0.3, double autostepMinWidth = 0.1, bool autostepIncludeDynamicBodies = true, double mass = 0.0})
Properties
- autostep → bool
-
final
- autostepIncludeDynamicBodies → bool
-
final
- autostepMaxHeight → double
-
final
- autostepMinWidth → double
-
final
- 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
- mass → double
-
Mass applied when pushing dynamic bodies.
0pushes nothing.final - maxSlopeClimbAngle → double
-
final
- minSlopeSlideAngle → double
-
final
- node → Node
-
The node this component is attached to.
no setterinherited
- offset → double
-
Gap kept between the character and obstacles.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- slide → bool
-
Whether blocked motion slides along obstacles.
final
- snapToGround → double?
-
Maximum ground distance to snap down to when walking off edges, or
null to disable snapping.
final
- up → Vector3
-
The character's up direction.
final
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.
fixedDtis the fixed timestep of the surrounding PhysicsWorld, not the frame interval.inherited -
move(
Vector3 desiredTranslation, {double? deltaSeconds}) → CharacterMovement -
Moves by up to
desiredTranslation, sliding along obstacles, and applies the corrected translation to the node. -
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.
override
-
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.
deltaSecondsis the elapsed time since the previous tick.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited