Skip to main content

Class: HeadLedBody

A body whose head leads it. A standing body keeps its heading while its look stays within reach and turns only once the look strays past it, then until it faces the look within settle; the head covers the rest. A walking body faces where it travels, turned only as far toward its look as keeps the look within reach. Yaws are atan2(dx, dz) of a heading.

Constructors​

constructor​

• new HeadLedBody(options?): HeadLedBody

Parameters​

NameTypeDefault value
optionsHeadLedBodyOptionsdefaultHeadLedBodyOptions

Returns​

HeadLedBody

Properties​

options​

• options: HeadLedBodyOptions = defaultHeadLedBodyOptions


yaw​

• yaw: number = 0

The body's yaw.

Methods​

offset​

▸ offset(lookYaw): number

The look's yaw minus the body's, wrapped to [-pi, pi].

Parameters​

NameType
lookYawnumber

Returns​

number


snap​

▸ snap(yaw): void

Face yaw at once, with no turn in progress.

Parameters​

NameType
yawnumber

Returns​

void


update​

▸ update(lookYaw, x, z, delta): number

Advance the body one frame toward lookYaw from where it stands now (x, z, the streamed position), and return its yaw.

Parameters​

NameType
lookYawnumber
xnumber
znumber
deltanumber

Returns​

number