Component · physics2d
Collider2d
Collision geometry, material, layer and trigger settings for a
RigidBody2d.Fields
kind
ColliderKind2dPrimitive type or convex polygon.
default "box"
One ofboxcirclecapsulepolygon
halfExtents
vec2Box half extents; scale must be baked before physics extraction.
default [0.5,0.5]m≥ 0.0001
radius
f32Circle or capsule radius.
default 0.5m≥ 0.0001
halfHeight
f32Capsule segment half height, excluding the end caps.
default 0.5m≥ 0
points
list<vec2>Local convex hull input for polygons, in metres.
default []
layer
u32Zero selects static/moving defaults from the body; 1..15 select an explicit group.
default 00 – 15
sensor
boolReport overlaps without a collision response.
default false
friction
f32Coulomb friction coefficient.
default 0.6≥ 0
restitution
f32Elasticity: zero is inelastic, one is perfectly elastic.
default 00 – 1
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=Collider2d --why "Add Collider2d"Set a field
ara do property.set -p entity=name:Crate -p path=Collider2d.kind -p value="box" --why "Tune Collider2d"In a scene document
{
"Collider2d": {
"kind": "box"
}
}From C#
/// <summary>Make a 2D ball bounce.</summary>
public static void UseCollider2d(Entity entity, in Tick tick)
{
ref var component = ref World.Get<Collider2d>(entity);
component.Restitution = 0.6f;
}From C#
Scripts read and write it with Get<Collider2d>(); see the Collider2d struct.