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
| Name | Type | Default value |
|---|---|---|
options | HeadLedBodyOptions | defaultHeadLedBodyOptions |
Returns
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
| Name | Type |
|---|---|
lookYaw | number |
Returns
number
snap
▸ snap(yaw): void
Face yaw at once, with no turn in progress.
Parameters
| Name | Type |
|---|---|
yaw | number |
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
| Name | Type |
|---|---|
lookYaw | number |
x | number |
z | number |
delta | number |
Returns
number