Component · physics2d
CharacterMotion2d
Character support mirrored at every fixed boundary.
Fields
grounded
boolWalkable ground support after the last move.
default falsereplicated · owner, rollback
groundNormal
vec2Supporting surface normal; zero while airborne.
default [0,0]replicated · 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=CharacterMotion2d --why "Add CharacterMotion2d"Set a field
ara do property.set -p entity=name:Crate -p path=CharacterMotion2d.grounded -p value=false --why "Tune CharacterMotion2d"In a scene document
{
"CharacterMotion2d": {
"grounded": false
}
}From C#
/// <summary>Restore grounded state when resetting a platform character on the floor.</summary>
public static void UseCharacterMotion2d(Entity entity, in Tick tick)
{
ref var component = ref World.Get<CharacterMotion2d>(entity);
component.Grounded = true;
}From C#
Scripts read and write it with Get<CharacterMotion2d>(); see the CharacterMotion2d struct.