Component · physics2d
CharacterController2d
Kinematic capsule character: slopes, steps, ground snapping and pushing. The entity needs no RigidBody2d/Collider2d; the controller owns its capsule.
Fields
radius
f32Capsule radius.
default 0.3m≥ 0.001
height
f32Complete capsule height; must exceed twice the radius.
default 1.8m≥ 0.001
maxSlopeDeg
f32Maximum walkable slope angle.
default 45deg0.1 – 89.9
stepHeight
f32Maximum step height climbed automatically; zero disables stepping.
default 0.25m≥ 0
stickDown
f32Distance searched below the feet to stay on descending ground; zero disables it.
default 0.2m≥ 0
padding
f32Collision padding kept between the capsule and the world.
default 0.01m≥ 0.0001
layer
u32Collision group used for movement queries.
default 11 – 15
Usage
Every edit is an undoable command: from the CLI as below, or the same JSON from an agent over MCP. See component.add and property.set.
Add it
ara do component.add -p entity=name:Crate -p component=CharacterController2d --why "Add CharacterController2d"Set a field
ara do property.set -p entity=name:Crate -p path=CharacterController2d.radius -p value=0.3 --why "Tune CharacterController2d"In a scene document
{
"CharacterController2d": {
"radius": 0.3
}
}From C#
/// <summary>Tune a platform character for shallow steps.</summary>
public static void UseCharacterController2d(Entity entity, in Tick tick)
{
ref var component = ref World.Get<CharacterController2d>(entity);
component.StepHeight = 0.3f;
}From C#
Scripts read and write it with Get<CharacterController2d>(); see the CharacterController2d struct.