Skip to content

five-on-it / apps/client/src/renderer/ragdoll / Ragdoll

Class: Ragdoll ​

Defined in: apps/client/src/renderer/ragdoll.ts:152

One limp body.

Constructors ​

Constructor ​

new Ragdoll(points, velocity, spin?): Ragdoll

Defined in: apps/client/src/renderer/ragdoll.ts:171

A ragdoll from the joints' places now (world, m, by point: see posedPoints), moving at velocity (m/s) and turning at spin (rad/s) about centre.

Parameters ​

points ​

Float32Array

velocity ​
x ​

number

y ​

number

z ​

number

spin? ​
x ​

number

y ​

number

z ​

number

Returns ​

Ragdoll

Properties ​

age ​

age: number = 0

Defined in: apps/client/src/renderer/ragdoll.ts:162

How long it has run (s), and how long it has been still (s).


p ​

readonly p: Float32Array<ArrayBuffer>

Defined in: apps/client/src/renderer/ragdoll.ts:154

The points now and a step ago (x, y, z each).


q ​

readonly q: Float32Array<ArrayBuffer>

Defined in: apps/client/src/renderer/ragdoll.ts:155


state ​

state: RagdollState = 'active'

Defined in: apps/client/src/renderer/ragdoll.ts:160

Simulating, or still and frozen.

Accessors ​

speed ​

Get Signature ​

get speed(): number

Defined in: apps/client/src/renderer/ragdoll.ts:209

Its fastest point's speed (m/s).

Returns ​

number

Methods ​

distance() ​

distance(a, b): number

Defined in: apps/client/src/renderer/ragdoll.ts:199

How far apart two points are now (m).

Parameters ​

a ​

number

b ​

number

Returns ​

number


lying() ​

lying(out): Quaternion

Defined in: apps/client/src/renderer/ragdoll.ts:403

The torso's turn now (the actor's frame: left +x, up +y, forward +z), for the figure getting up from it.

Parameters ​

out ​

Quaternion

Returns ​

Quaternion


partWorlds() ​

partWorlds(out): void

Defined in: apps/client/src/renderer/ragdoll.ts:418

Writes every part's world matrix for the batches: the part's own frame (the model file's, turned half a circle: its x the figure's right, its y up its limb, its z the figure's back) on its bone, its joint at its point.

Parameters ​

out ​

Map<"head" | "torso" | "arm-l" | "arm-r" | "forearm-l" | "forearm-r" | "leg-l" | "leg-r" | "shin-l" | "shin-r", Matrix>

Returns ​

void


settle() ​

settle(): void

Defined in: apps/client/src/renderer/ragdoll.ts:389

Still at last: frozen where it lies.

Returns ​

void


settleNow() ​

settleNow(world): void

Defined in: apps/client/src/renderer/ragdoll.ts:395

Lays it flat at once where it is (beyond the cap): every point down on the ground, then settled.

Parameters ​

world ​

RagdollWorld

Returns ​

void


update() ​

update(dt, world, anchor?): boolean

Defined in: apps/client/src/renderer/ragdoll.ts:227

Runs the body dt seconds on (in fixed steps, three at most a frame), against world, drifting toward anchor (the server's capsule, if any). Returns false once it is lost (too far from the capsule: that body respawned).

Parameters ​

dt ​

number

world ​

RagdollWorld

anchor? ​
x ​

number

y ​

number

z ​

number

Returns ​

boolean