Ara
Download

Search or run a command

Jump to a section or open an Ara link.

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

f32
Capsule radius.
default 0.3m≥ 0.001

height

f32
Complete capsule height; must exceed twice the radius.
default 1.8m≥ 0.001

maxSlopeDeg

f32
Maximum walkable slope angle.
default 45deg0.1 – 89.9

stepHeight

f32
Maximum step height climbed automatically; zero disables stepping.
default 0.25m≥ 0

stickDown

f32
Distance searched below the feet to stay on descending ground; zero disables it.
default 0.2m≥ 0

padding

f32
Collision padding kept between the capsule and the world.
default 0.01m≥ 0.0001

layer

u32
Collision 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.

Used by