API reference

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

C

classCollider

@codexo/exojs-physics / physics / stable

Geometry attached to a PhysicsBody: a Shape plus a body-local offset/rotation, material (friction/restitution/density) and a collision filter. A body may own several colliders (compound). The collider also caches its world-space geometry - refreshed by synchronize - which the broad phase, narrow phase and queries read directly. Material fields and the filter are mutable; the shape and local placement are immutable (rebuild the collider to change geometry).

18
props
1
methods
0
events
Import
import { Collider } from '@codexo/exojs-physics'

Geometry attached to a PhysicsBody: a Shape plus a body-local offset/rotation, material (friction/restitution/density) and a collision filter. A body may own several colliders (compound). The collider also caches its world-space geometry - refreshed by synchronize - which the broad phase, narrow phase and queries read directly.

Material fields and the filter are mutable; the shape and local placement are immutable (rebuild the collider to change geometry).

Constructors1
Methods1
synchronize(bodyTransform: Transform): void
Recompute the cached world geometry from the body's transform. Called by the body on setTransform, on collider creation, and by the world before each detection pass.
Properties18
density: number
friction: number
isSensor: boolean
localRotation: number
offsetX: number
offsetY: number
restitution: number
The body this collider belongs to. null until the collider has been added to a body that has joined a world (free-standing colliders have no body yet).
destroyed: boolean
true after the owning world has destroyed this collider.
id: number
Stable id, assigned when the owning body joins a world via world.add(); -1 until then.
localTransform: Readonly<Transform>
The collider's body-local transform (offset + local rotation).
World-space circle centre (only meaningful for circle shapes).
worldNormals: readonly number[]
World-space polygon outward normals [x0, y0, ...] (only meaningful for polygon shapes).
worldTransform: Readonly<Transform>
The collider's world transform (offset/rotation composed with the body's).
worldVertices: readonly number[]
World-space polygon vertices [x0, y0, ...] (only meaningful for polygon shapes).
Source