API reference
Every public class, method, and event in @codexo/exojs. Generated from source.
classChainShape
A connected boundary through a run of local-space vertices: level outlines, terrain, the ground of a side-scroller. Open (a polyline) or closed (a loop). A chain is not an array of SegmentShapes. At a shared vertex two independent segments carry two different normals, so a body sliding across the seam can snag, be launched, or receive a normal pointing into the surface. A chain owns the adjacency between its edges and uses it to suppress exactly those contacts, which is why the adjacency belongs to the engine rather than to the caller. Unlike a segment, a chain is **one-sided**: each edge collides only from the side its outward normal points to. Winding therefore decides which side is solid, following the polygon convention - a counter-clockwise run is solid on the outside (an island), a clockwise run is solid on the inside (a container). Bodies on the hollow side pass through. It has no interior, so Shape.massProperties is `null` and a `dynamic` body needs at least one mass-bearing collider alongside it. A `static` or `kinematic` body carries a chain on its own. Collinear vertices are kept. A straight run is authoring data, and dropping it would move the adjacency of the neighbouring edges.
import { ChainShape } from '@codexo/exojs-physics'A connected boundary through a run of local-space vertices: level outlines, terrain, the ground of a side-scroller. Open (a polyline) or closed (a loop).
A chain is not an array of SegmentShapes. At a shared vertex two independent segments carry two different normals, so a body sliding across the seam can snag, be launched, or receive a normal pointing into the surface. A chain owns the adjacency between its edges and uses it to suppress exactly those contacts, which is why the adjacency belongs to the engine rather than to the caller.
Unlike a segment, a chain is **one-sided**: each edge collides only from the side its outward normal points to. Winding therefore decides which side is solid, following the polygon convention - a counter-clockwise run is solid on the outside (an island), a clockwise run is solid on the inside (a container). Bodies on the hollow side pass through.
It has no interior, so Shape.massProperties is `null` and a `dynamic` body needs at least one mass-bearing collider alongside it. A `static` or `kinematic` body carries a chain on its own.
Collinear vertices are kept. A straight run is authoring data, and dropping it would move the adjacency of the neighbouring edges.
new(vertices: readonly Readonly<PointLikeStructural type for any object with a 2D `x`/`y` position.>[], options: ChainShapeOptionsConstruction options for a ChainShape.): ChainShapeboundingRadius: numberclosed: booleancount: numberedgeCount: numbermassProperties: nulltype: "chain"vertices: readonly number[]