Component · physics2d
CharacterInput2d
Per-tick character intent, read exactly once by each boundary. Gameplay writes it before the physics system; it is not cleared, so held input repeats.
Fields
desiredVelocity
vec2Desired world-space velocity. With gravity it must be perpendicular to gravity (vertical motion comes from gravity and jumps); zero-gravity worlds use both axes.
default [0,0]m/sreplicated · owner, rollback
jumpSpeed
f32Jump launch speed, applied only while grounded; zero means no jump this tick.
default 0m/s≥ 0replicated · owner, rollback
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=CharacterInput2d --why "Add CharacterInput2d"Set a field
ara do property.set -p entity=name:Crate -p path=CharacterInput2d.desiredVelocity -p value=[0,0] --why "Tune CharacterInput2d"In a scene document
{
"CharacterInput2d": {
"desiredVelocity": [
0,
0
]
}
}From C#
/// <summary>Request a platform jump this fixed tick.</summary>
public static void UseCharacterInput2d(Entity entity, in Tick tick)
{
ref var component = ref World.Get<CharacterInput2d>(entity);
component.JumpSpeed = 6f;
}From C#
Scripts read and write it with Get<CharacterInput2d>(); see the CharacterInput2d struct.