API reference

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

C

classCapsuleShape

@codexo/exojs-physics / physics / stable

A capsule: the set of points within `radius` of the segment between two local-space endpoints. Exact geometry, never a polygon approximation - the mass model and the narrow phase both work on the spine and the radius, so nothing about a capsule depends on a tessellation constant. The spine is given as two points rather than a centre, a half-height and an angle: every consumer needs the two endpoints, and the collider already carries a local rotation, so an angle on the shape would be a second and redundant orientation. A zero-length spine is rejected rather than quietly becoming a circle - use CircleShape to say that.

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

A capsule: the set of points within `radius` of the segment between two local-space endpoints. Exact geometry, never a polygon approximation - the mass model and the narrow phase both work on the spine and the radius, so nothing about a capsule depends on a tessellation constant.

The spine is given as two points rather than a centre, a half-height and an angle: every consumer needs the two endpoints, and the collider already carries a local rotation, so an angle on the shape would be a second and redundant orientation.

A zero-length spine is rejected rather than quietly becoming a circle - use CircleShape to say that.

Constructors1
new(x0: number, y0: number, x1: number, y1: number, radius: number): CapsuleShape
Properties7
boundingRadius: number
Radius of the smallest circle about the local origin enclosing the shape.
length: number
Spine length; the capsule is length + 2 × radius long overall.
normals: readonly number[]
Outward unit normals of the two spine sides, flattened.
radius: number
type: "capsule"
vertices: readonly number[]
Local spine endpoints, flattened - the same layout a polygon uses.
Source