Skip to main content

BoundaryRicochetUpdate

@zylem/game-lib


@zylem/game-lib / behavior / BoundaryRicochetUpdate

Interface: BoundaryRicochetUpdate<THits, TNormal>

Defined in: node_modules/.pnpm/@zylem+behaviors@0.8.9_@types+react@19.3.0_react@19.3.0_three@0.185.1/node_modules/@zylem/behaviors/dist/index.d.ts:48

Shared boundary→ricochet glue used by the 2D and 3D boundary-ricochet coordinators. Reads the boundary behavior's last hits, optionally snaps the body back inside the bounds, and applies the ricochet reflection.

Type Parameters​

THits​

THits

TNormal​

TNormal

Methods​

applyRicochet()​

applyRicochet(normal): boolean

Defined in: node_modules/.pnpm/@zylem+behaviors@0.8.9_@types+react@19.3.0_react@19.3.0_three@0.185.1/node_modules/@zylem/behaviors/dist/index.d.ts:58

Apply the reflection; returns true when a ricochet occurred.

Parameters​

normal​

TNormal

Returns​

boolean


getLastHits()​

getLastHits(): THits | null

Defined in: node_modules/.pnpm/@zylem+behaviors@0.8.9_@types+react@19.3.0_react@19.3.0_three@0.185.1/node_modules/@zylem/behaviors/dist/index.d.ts:50

Boundary behavior handle (or any source of last-frame hits).

Returns​

THits | null


getNormal()​

getNormal(hits): TNormal

Defined in: node_modules/.pnpm/@zylem+behaviors@0.8.9_@types+react@19.3.0_react@19.3.0_three@0.185.1/node_modules/@zylem/behaviors/dist/index.d.ts:54

Convert hits into a reflection normal.

Parameters​

hits​

THits

Returns​

TNormal


hasAnyHit()​

hasAnyHit(hits): boolean

Defined in: node_modules/.pnpm/@zylem+behaviors@0.8.9_@types+react@19.3.0_react@19.3.0_three@0.185.1/node_modules/@zylem/behaviors/dist/index.d.ts:52

Whether any boundary face was hit this frame.

Parameters​

hits​

THits

Returns​

boolean


snapToClamped()?​

optional snapToClamped(): void

Defined in: node_modules/.pnpm/@zylem+behaviors@0.8.9_@types+react@19.3.0_react@19.3.0_three@0.185.1/node_modules/@zylem/behaviors/dist/index.d.ts:56

Optional pre-reflection snap (e.g. clamp the body back inside bounds).

Returns​

void