API reference

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

C

classSegmentShape

@codexo/exojs-physics / physics / stable

A zero-thickness boundary between two local-space endpoints: level edges, one-off walls, the geometry a body may not cross. It has no interior, so Shape.massProperties is `null` and the shape contributes collision only - a `dynamic` body needs at least one mass-bearing collider alongside it. A segment blocks from **both** sides. There is no inside for it to be outside of, and a one-sided segment would be a gameplay rule in a geometry costume: express that with the world's `contactModifier`, which decides per contact and per step whether it is solved. Being zero-thickness makes it the worst case for discrete detection - a body that crosses it entirely within one fixed step misses it. Continuous collision covers a fast body against a segment; a fast segment is not swept.

6
props
0
methods
0
events
Import
import { SegmentShape } from '@codexo/exojs-physics'

A zero-thickness boundary between two local-space endpoints: level edges, one-off walls, the geometry a body may not cross.

It has no interior, so Shape.massProperties is `null` and the shape contributes collision only - a `dynamic` body needs at least one mass-bearing collider alongside it.

A segment blocks from **both** sides. There is no inside for it to be outside of, and a one-sided segment would be a gameplay rule in a geometry costume: express that with the world's `contactModifier`, which decides per contact and per step whether it is solved.

Being zero-thickness makes it the worst case for discrete detection - a body that crosses it entirely within one fixed step misses it. Continuous collision covers a fast body against a segment; a fast segment is not swept.

Constructors1
new(x0: number, y0: number, x1: number, y1: number): SegmentShape
Properties6
boundingRadius: number
Radius of the smallest circle about the local origin enclosing the shape.
length: number
massProperties: null
Always null: a boundary has no interior and therefore no mass.
normals: readonly number[]
The two opposite outward unit normals, flattened.
type: "segment"
vertices: readonly number[]
Local endpoints, flattened - the same layout a polygon uses.
Source