API reference

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

C

classPhysicsBody

@codexo/exojs-physics / physics / stable

A rigid body: a world transform plus mass properties aggregated from its colliders. Dynamic bodies integrate under gravity, accumulated forces/torque and contact impulses each fixed sub-step; static bodies never move; kinematic bodies move by their velocity only and stay immovable under contacts. Drive a body with applyForce, applyTorque and applyImpulse, or set linearVelocityX/linearVelocityY/angularVelocity directly; reposition it (teleport, no velocity) with setTransform.

29
props
9
methods
0
events
Import
import { PhysicsBody } from '@codexo/exojs-physics'

A rigid body: a world transform plus mass properties aggregated from its colliders. Dynamic bodies integrate under gravity, accumulated forces/torque and contact impulses each fixed sub-step; static bodies never move; kinematic bodies move by their velocity only and stay immovable under contacts. Drive a body with applyForce, applyTorque and applyImpulse, or set linearVelocityX/linearVelocityY/angularVelocity directly; reposition it (teleport, no velocity) with setTransform.

Constructors 1
new(options: BodyOptions): PhysicsBody
Methods 9
_markDestroyed(): void
_removeCollider(collider: Collider): void
addCollider(collider: Collider | ColliderOptions): Collider
applyForce(forceX: number, forceY: number): this
applyImpulse(impulseX: number, impulseY: number, pointX?: number, pointY?: number): this
applyTorque(torque: number): this
setTransform(position: VectorLike, angle: number): this
synchronizeColliders(): void
wake(): this
Properties 29
allowSleep: boolean
angularDamping: number
angularVelocity: number
fixedRotation: boolean
gravityScale: number
inertia: number
invInertia: number
invMass: number
isBullet: boolean
linearDamping: number
linearVelocityX: number
linearVelocityY: number
mass: number
type: BodyType
angle: number
attached: boolean
centerOfMassX: number
centerOfMassY: number
colliders: readonly Collider[]
destroyed: boolean
id: number
isMassReady: boolean
isSleeping: boolean
position: Vector
transform: Readonly<Transform>
worldCenterOfMassX: number
worldCenterOfMassY: number
x: number
y: number
Source