Skip to content

API Type ShapeDesc2D

github-actions[bot] edited this page Nov 24, 2026 · 3 revisions

Type Alias: ShapeDesc2D

type ShapeDesc2D = 
  | {
  halfExtents: PhysicsVec2;
  kind: "box";
}
  | {
  kind: "circle";
  radius: number;
}
  | {
  halfHeight: number;
  kind: "capsule";
  radius: number;
}
  | {
  kind: "convexPolygons";
  label?: string;
  outline: readonly PhysicsPoint2[];
  parts: readonly (readonly PhysicsPoint2[])[];
}
  | {
  kind: "convexHull";
  points: readonly PhysicsPoint2[];
}
  | {
  kind: "polyline";
  oriented?: boolean;
  points: readonly PhysicsPoint2[];
}
  | {
  fixInternalEdges?: boolean;
  kind: "compound";
  parts: readonly object[];
};

Defined in: src/plugins/physics/runtime/backend.ts:41

2D shapes, in the collider's frame.

Union Members

Type Literal

{
  halfExtents: PhysicsVec2;
  kind: "box";
}

Type Literal

{
  kind: "circle";
  radius: number;
}

Type Literal

{
  halfHeight: number;
  kind: "capsule";
  radius: number;
}

Upright (along y); halfHeight is the straight part's.


Type Literal

{
  kind: "convexPolygons";
  label?: string;
  outline: readonly PhysicsPoint2[];
  parts: readonly (readonly PhysicsPoint2[])[];
}

A polygon split into convex parts (one part: a convex hull). If a part has no hull, the closed outline collides as a line.


Type Literal

{
  kind: "convexHull";
  points: readonly PhysicsPoint2[];
}

The convex hull of the points (a tiny circle when they have none).


Type Literal

{
  kind: "polyline";
  oriented?: boolean;
  points: readonly PhysicsPoint2[];
}

A line through the points; closed shapes repeat the first point. Oriented lines are solid on their left only.


Type Literal

{
  fixInternalEdges?: boolean;
  kind: "compound";
  parts: readonly object[];
}

Several shapes as one collider; fixInternalEdges keeps bodies sliding over the seams from catching.

Clone this wiki locally