Skip to content

PhysicsAPI

Defined in: packages/threeplay/src/plugins/physics/types.ts:193

API of the physics plugin.

area(opts?): AreaComp

Defined in: packages/threeplay/src/plugins/physics/types.ts:196

AreaOpts

AreaComp


body(opts?): BodyComp

Defined in: packages/threeplay/src/plugins/physics/types.ts:197

BodyOpts

BodyComp


character(opts?): CharacterComp

Defined in: packages/threeplay/src/plugins/physics/types.ts:198

CharacterOpts

CharacterComp


getGravity(): Vector3

Defined in: packages/threeplay/src/plugins/physics/types.ts:201

Vector3


onCollide(tagA, tagB, fn): EventController

Defined in: packages/threeplay/src/plugins/physics/types.ts:205

When an object with tagA starts touching one with tagB.

string

string

(a, b, col) => void

EventController


onCollideEnd(tagA, tagB, fn): EventController

Defined in: packages/threeplay/src/plugins/physics/types.ts:215

string

string

(a, b) => void

EventController


onCollideUpdate(tagA, tagB, fn): EventController

Defined in: packages/threeplay/src/plugins/physics/types.ts:210

string

string

(a, b, col) => void

EventController


raycast(origin, dir, maxDist?, opts?): RaycastHit | null

Defined in: packages/threeplay/src/plugins/physics/types.ts:203

First object hit by a ray.

Vec3Like

Vec3Like

number

RaycastOpts

RaycastHit | null


setGravity(g): void

Defined in: packages/threeplay/src/plugins/physics/types.ts:200

Gravity: a number pulls down (−Y) with that strength (default 20).

number | Vec3Like

void

readonly physics: PhysicsBackend

Defined in: packages/threeplay/src/plugins/physics/types.ts:195

The physics backend (escape hatch: physics.world, physics.native).