Ara
Download

Search or run a command

Jump to a section or open an Ara link.

Component · physics2d

RigidBody2d

Rigid-body authoring settings; simulation state is written to pose and velocity.

Fields

Static, kinematic, or dynamic motion.
default "static"

One ofstatickinematicdynamic

mass

f32
Mass in kilograms; zero computes mass from the collider's 1 kg/m2 area density.
default 0kg≥ 0

allowSleep

bool
Permit inactive bodies to sleep.
default true

continuous

bool
Use swept collision detection for fast bodies.
default false

lockRotation

bool
Prevent physical rotation, for upright props and platforms.
default false

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=RigidBody2d --why "Add RigidBody2d"

Set a field

ara do property.set -p entity=name:Crate -p path=RigidBody2d.motion -p value="static" --why "Tune RigidBody2d"

In a scene document

{
  "RigidBody2d": {
    "motion": "static"
  }
}

From C#

/// <summary>Give a 2D pickup a small physical mass.</summary>
public static void UseRigidBody2d(Entity entity, in Tick tick)
{
    ref var component = ref World.Get<RigidBody2d>(entity);
    component.Mass = 2f;
}

From C#

Scripts read and write it with Get<RigidBody2d>(); see the RigidBody2d struct.

Used by