API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

C

classChainShape

@codexo/exojs-physics / physics / stable

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.

7
props
0
methods
0
events
Import
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.

Constructors1
Properties7
boundingRadius: number
Radius of the smallest circle about the local origin enclosing the shape.
closed: boolean
count: number
Number of vertices in vertices.
edgeCount: number
Number of edges: count when closed, count - 1 otherwise.
massProperties: null
Always null: a boundary has no interior and therefore no mass.
type: "chain"
vertices: readonly number[]
Local-space vertices, flattened, after welding coincident input.
Source