@ferret/micromotion
Idle people that are never still: a profile and a seed give a person who gestures, looks about, fidgets, walks about his place, speaks with beats and reacts to blasts and impacts; levels of detail, clips as masked layers, micro.* commands.
Read the guide: how to use it →
Classes
ClipBank class
class ClipBankadd(c: MotionClip): this | |
has(gesture: string): boolean | |
variants(gesture: string): readonly MotionClip[] | |
size(): number | |
choose(gesture: string, seed: number, startedAt: number, handedness: 'left' | 'right', style: { amplitude?: number; speed?: number } = {}): ClipPlay | null | The clip for a gesture as one person plays it this time: the variant, speed and amplitude come from the person's seed and the start of the playback (the same inputs always give the same play), and a person of the other hand gets the mirror of a clip made for the module's frame. |
packages/micromotion/src/clips.ts:38
MicroSession class
class MicroSessionreadonly people: Map<string, MicroPerson> | |
readonly targets: Map<string, GazeTarget> | |
take: 'idle' | 'running' | |
t: number | |
frame: number | |
readonly thresholds: LodThresholds | |
readonly budget: LodBudget | |
occluded?: MicroWorld['occluded'] | |
onRemove?: (id: string) => void | called when a person is removed (a host that draws him lets go of his body) |
listen(fn: MicroListener): () => void | listen to what the people do (the motion language link, a game); returns the function that stops it |
constructor(o: MicroSessionOptions = {}) | |
spawn(id: string, prof: string | MicroProfile, seed: number, o: { pos?: Vec3; facing?: number; external?: boolean } = {}): PersonState | a person with a shipped profile (by name) or a profile of his own; the seed makes him: the same seed and profile give the same person |
remove(id: string): boolean | |
person(id: string): PersonState | |
setTarget(t: GazeTarget): void | |
removeTarget(id: string): boolean | |
step(dt: number): void | the sim, in the fixed step: every person, whatever his level |
stimulate(s: Stimulus): number | a stimulus for all (or those that perceive it): returns how many perceived it |
onEvent(name: string, payload: unknown): boolean | a bus event, mapped by stimulusOfEvent; false when it is not one the module listens to |
attach(bus: BusLike): () => void | listen to the bus; call the returned function to stop |
dispose(): void | |
assign(inputs: { id: string; px: number; visible?: boolean }[]): Map<string, MicroLod> | the levels of everyone for a camera: px is a person's height on the screen (see screenHeightPx), visible false for those out of view |
inspect(id: string) | what an agent needs to see of a person |
packages/micromotion/src/service.ts:24
Functions
activityLog function
function activityLog: (P: PersonState) => string[]the names of the activities and reactions in a person's log, in order (the sequence the UE build is compared against)
packages/micromotion/src/sim.ts:513
aimAt function
function aimAt(from: Vec3, facing: number, to: Vec3): GazeAimthe direction to a world point in the body frame: yaw (positive toward +x, the left), pitch (positive up); facing is the body's yaw in the world (0 = +z, positive toward +x)
packages/micromotion/src/gaze.ts:139
applyMicro function
function applyMicro(rig: RigLike, pose: PoseLike, out: MicroOut, profile: MicroProfile, o: MicroPoseOptions): MicroPoseReportThe pose of a living person: adds the micro-motion out of the sim to pose (in place). Returns the face weights and a report.
packages/micromotion/src/pose.ts:184
assignLods function
function assignLods(people: readonly LodInput[], budget: LodBudget = DEFAULT_BUDGET, t: LodThresholds = DEFAULT_THRESHOLDS): Map<string, MicroLod>The levels of a set of people: by size, then the budget demotes the farthest of the near ones to middle, and of the near-and-middle ones to far (the nearest keep theirs). Stable: ties go by id.
packages/micromotion/src/lod.ts:35
bakeLoop function
function bakeLoop(rig: RigLike, base: (t: number) => PoseLike, profile: MicroProfile, seed: number, posture: 'stand' | 'sit', o: BakeOptions = {}): BakedLoopRecord one loop of a person at rest. base(t) is the base pose the live person stands on (an idle clip at time t, a fresh pose each call).
packages/micromotion/src/bake.ts:59
bakePerson function
function bakePerson(rig: RigLike, base: (t: number) => PoseLike, profile: MicroProfile, seed: number, o: BakeOptions = {}): BakedPersonRecord the loops a person can have: standing, and sitting if his anchors have a seat. Done once, when the character is created.
packages/micromotion/src/bake.ts:91
bakeProfile function
function bakeProfile(p: MicroProfile, posture: 'stand' | 'sit'): MicroProfilethe profile as the recording sees him: at his place, nothing that needs a prop in hand or walks, so the loop is the person at rest
packages/micromotion/src/bake.ts:45
baseRate function
function baseRate(h: HabitName, t: Temperament): numberThe rate of a habit, times a minute, that the temperament gives: a calm person swings a leg or shifts his weight a couple of times a minute, a nervous one five or more.
packages/micromotion/src/ai.ts:85
beatPlan function
function beatPlan(line: Line): BeatEvent[]The gestures of a line: a beat on every stress and a nod on every second one, each starting early enough that its stroke lands on the stress.
packages/micromotion/src/speech.ts:48
blastSize function
function blastSize: (tnt: number) => numbera blast's size by its TNT equivalent in kg: 0.1 kg is a firecracker's bang near, 10 kg a loud blast, 100 kg and more the top of the scale
packages/micromotion/src/stimulus.ts:34
blinkClosure function
function blinkClosure(b: BlinkState): numbereyelid closure 0..1 now
packages/micromotion/src/life.ts:21
blinkInterval function
function blinkInterval(s: Stream, nervousness: number, arousal: number): numberthe seconds to the next blink: 2 to 5.5 s, shorter for a nervous or excited person
packages/micromotion/src/life.ts:26
blinkNow function
function blinkNow(b: BlinkState): voida blink now, because the gaze made a big shift (not while one is on)
packages/micromotion/src/life.ts:45
breathDepth function
function breathDepth: (arousal: number) => numberpackages/micromotion/src/life.ts:49
breathRate function
function breathRate: (arousal: number) => numberbreathing: the phase advances by rate cycles a second; the rate is 0.22 Hz at rest and up to 0.6 Hz when excited
packages/micromotion/src/life.ts:48
breathWave function
function breathWave(phase: number): numberthe chest's displacement for a phase in 0..1: a quicker breath in, a slower out, -1..1
packages/micromotion/src/life.ts:51
candidates function
function candidates(P: PersonState, w: MicroWorld, force: boolean): { names: string[]; weights: number[] }the activities that can be chosen now, with their weights
packages/micromotion/src/sim.ts:179
chooseReaction function
function chooseReaction(p: MicroProfile, kind: StimulusKind, strength: number, s: Stream): ReactionName | nullThe reaction a person has to a stimulus of this kind and strength, drawn from his table with the weights; null when his table has none that the strength allows (he only glances). The stronger the stimulus, the more the strong reactions count.
packages/micromotion/src/stimulus.ts:91
chooseTarget function
function chooseTarget(p: MicroProfile, seed: number, time: number, from: Vec3, targets: readonly GazeTarget[], held: { id: string | null; since: number }, maxFix: number, boost: Record<string, number> = {}): GazeChoiceThe most interesting target for a person at time. A target's score is the sum of: the profile's interest in each of its tags, its speed, its noise, whether it speaks,
how near it is, and a slow seeded noise per (person, target) that changes every 1.5 s (so equal targets take turns). The target held longer than maxFix is penalised, which
is the limit on locking the gaze (the caller also forces a switch past it). A short-lived event direction is a target of its own that the caller adds (id: 'event').
packages/micromotion/src/gaze.ts:29
clamp function
function clamp: (x: number, lo: number, hi: number) => numberpackages/micromotion/src/math.ts:7
deg function
function deg: (d: number) => numberpackages/micromotion/src/math.ts:44
enqueue function
function enqueue(P: AiBody, name: string, dur?: number): voidAn order: an activity (ACTIVITIES) or a habit by name. Checked now for what cannot change (it exists, its prop and seat are there); whether the posture fits is decided when its turn comes.
packages/micromotion/src/ai.ts:206
explain function
function explain(P: AiBody, weights: { names: string[]; weights: number[] } | null)Why he does what he does: the mode, each habit (rate, due, what stops it), the orders, and the weights of the activities he may choose (weights from candidates).
packages/micromotion/src/ai.ts:219
explainPerson function
function explainPerson(P: PersonState, w: MicroWorld = EMPTY_WORLD)Why he does what he does (see explain in ai.ts): includes the chances of his next choice.
packages/micromotion/src/sim.ts:292
eyePos function
function eyePos: (P: PersonState) => Vec3packages/micromotion/src/sim.ts:129
faceOf function
function faceOf(out: MicroOut, seed: number, t: number, mood: number): FaceWeightsthe face: the face at rest, the face of the reaction or shout in progress (ramped in and out), the eyes' gaze and the blink; the largest value of each shape wins
packages/micromotion/src/frame.ts:88
faceRest function
function faceRest(seed: number, t: number, mood: number, arousal: number): FaceWeightsthe face at rest as ARKit weights: the mood sets a slight smile or frown, the brows and jaw drift, excitement widens the eyes. Blinks and gaze are added by the pose layer.
packages/micromotion/src/life.ts:69
fingerCurl function
function fingerCurl(seed: number, t: number, finger: number, side: number, nervousness: number): numberthe curl of one finger 0..1 (the hand's rest: fingers a little curled, each its own way); finger 0 index .. 3 pinky, 4 thumb, side 0 or 1
packages/micromotion/src/life.ts:64
fkInto function
function fkInto(rig: RigLike, pose: PoseLike, pos: Float32Array, wq: Float32Array, order?: Int16Array): { pos: Float32Array; q: Float32Array }forward kinematics into the given buffers (world positions and rotations), no allocation
packages/micromotion/src/pose.ts:86
frameOf function
function frameOf(out: MicroOut, profile: MicroProfile, o: FrameOptions): MicroFramepackages/micromotion/src/frame.ts:32
glanceAim function
function glanceAim(seed: number, n: number, around: GazeAim): GazeAimA seeded glance direction away from the current gaze: a little to the side and down or up, within the eyes' and head's range.
packages/micromotion/src/gaze.ts:145
habitBlock function
function habitBlock(P: AiBody, h: HabitName): string | nullIs the habit possible now? (the reason it is not, or null)
packages/micromotion/src/ai.ts:120
hash32 function
function hash32: (x: number) => numberpackages/micromotion/src/rng.ts:5
hashRand function
function hashRand: (seed: number, a: number, b?: number) => numbera number in [0, 1) that is a pure function of (seed, a, b): for things that must not depend on how many numbers were drawn before
packages/micromotion/src/rng.ts:24
headDir function
function headDir(P: PersonState): Vec3the world direction the head faces (unit)
packages/micromotion/src/sim.ts:131
hear function
function hear(P: PersonState, st: Stimulus, occluded?: (a: Vec3, b: Vec3) => boolean): booleanA person hears of a stimulus: what he perceives of it, when, and what he does (a reaction from his table after his reaction time, a glance first). Returns true when he perceives it.
packages/micromotion/src/sim.ts:138
heardStrength function
function heardStrength(s: Stimulus, dist: number): numberthe strength of a stimulus at a distance as heard (sound)
packages/micromotion/src/stimulus.ts:39
impactSize function
function impactSize: (impulse: number) => numberan impact's size by its impulse in N s: a dropped tool, 5 N s, is small; 2000 N s is a car hitting a wall
packages/micromotion/src/stimulus.ts:36
lerp function
function lerp: (a: number, b: number, t: number) => numberpackages/micromotion/src/math.ts:8
linkMotion function
function linkMotion(session: MicroSession, bridge: MotionBridgeLike): () => voidRegisters the words on a bridge and forwards the session's events to the runtime. Returns the function that stops the forwarding (the words stay; they do nothing for a session that is gone). Call it once per bridge, before the programs that use the words are loaded (the language checks names when it loads).
packages/micromotion/src/motion.ts:42
lodOfPx function
function lodOfPx(px: number, visible = true, t: LodThresholds = DEFAULT_THRESHOLDS): MicroLodthe level by size alone (no budget); visible false is off
packages/micromotion/src/lod.ts:23
loopFor function
function loopFor(P: PersonState, baked: BakedPerson | undefined): BakedLoop | nullwhich loop (if any) a person at this moment may be shown by: only a person at rest, standing or seated, with nothing in hand, and not reacting, walking, speaking or changing posture
packages/micromotion/src/bake.ts:111
loopTime function
function loopTime: (seed: number, t: number, loop: BakedLoop) => numberthe time in the loop for a person: the sim clock at a phase of his seed, so people of one profile are not in step
packages/micromotion/src/bake.ts:119
maxFixation function
function maxFixation(p: MicroProfile): numberhow long the gaze may stay on one thing, s: the profile's maximum scaled by the person's focus and nervousness
packages/micromotion/src/gaze.ts:51
mirrorClip function
function mirrorClip(rig: RigLike, clip: MotionClip): MotionClippackages/micromotion/src/clips.ts:113
mirrorIndex function
function mirrorIndex(rig: RigLike): Int16Arraypackages/micromotion/src/clips.ts:71
mirrorPose function
function mirrorPose(rig: RigLike, pose: PoseLike): PoseLikeThe mirror of a pose about the body's middle plane (x to -x): every joint's turn from rest is reflected and given to the joint of the other side. Done on world rotations, so it does not depend on how the rig's local axes lie; the pelvis' offset is mirrored in x. A pose mirrored twice is the pose.
packages/micromotion/src/clips.ts:92
missingGestures function
function missingGestures(): string[]every gesture an activity or reaction names exists (checked by the tests and the validator)
packages/micromotion/src/activities.ts:78
newAi function
function newAi(profile: MicroProfile, seed: number, startT: number): AiStatepackages/micromotion/src/ai.ts:104
newBlink function
function newBlink: (first: number) => BlinkStatepackages/micromotion/src/life.ts:17
newGazeFrame function
function newGazeFrame: () => GazeFramepackages/micromotion/src/gaze.ts:88
newPerson function
function newPerson(id: string, profile: MicroProfile, seed: number, o: NewPersonOptions = {}): PersonStatepackages/micromotion/src/sim.ts:107
nextBlinkAt function
function nextBlinkAt(P: AiBody, now: number): number | nullThe next blink at now, as the settings want it: the sim calls this when a blink begins; returns the time of the next, or null to leave the life layer's own.
packages/micromotion/src/ai.ts:167
nextGlanceIn function
function nextGlanceIn(p: MicroProfile, s: Stream): numberthe seconds until the next glance away, from the profile's rate and nervousness (seeded)
packages/micromotion/src/gaze.ts:56
noise1 function
function noise1(seed: number, channel: number, t: number): numbera smooth noise in [-1, 1] of time t for a seed and channel (value noise, 1-D)
packages/micromotion/src/rng.ts:26
order function
function order(P: PersonState, name: string, o: { dur?: number; now?: boolean } = {}): voidOrder an activity or a habit by name; it starts as soon as he is free (or at once with now, which drops the activity he is in).
packages/micromotion/src/sim.ts:287
perceive function
function perceive(o: Observer, s: Stimulus, occluded?: (from: Vec3, to: Vec3) => boolean): Perceived | nullWhat a person perceives of a stimulus, or null. A stimulus with no place reaches everyone at once ('told'). One with a place is heard when its strength at his ear is
above the threshold (after the sound's delay), seen when it is in his field of view and occluded (smoke, a wall) says the line is clear; the earlier of the two counts.
packages/micromotion/src/stimulus.ts:68
pickWeighted function
function pickWeighted(weights: readonly number[], r: number): numbera weighted pick: the weights of the items, the value of a draw in [0, 1)
packages/micromotion/src/rng.ts:32
playClip function
function playClip(rig: RigLike, pose: PoseLike, play: ClipPlay, u: number): voidPlay a clip over a pose as a masked layer: the bones the clip names get the clip's turn since its own first frame (in the bone's own frame, scaled by the amplitude) laid on the
pose's rotation, blended in by the envelope of the gesture (the fade in and out). u is the gesture's progress 0..1.
packages/micromotion/src/clips.ts:141
playLoop function
function playLoop(rig: RigLike, pose: PoseLike, loop: BakedLoop, t: number): voidLay a loop on a pose at time t (wrapping): the recorded rotations of its bones and the pelvis replace the pose's. The loop is a pose of the whole body at rest, so nothing is blended.
packages/micromotion/src/bake.ts:98
poseFrame function
function poseFrame(rig: RigLike, pose: PoseLike, f: MicroFrame, clips?: (pose: PoseLike) => void): MicroPoseReportApplies a frame to a skeleton: the torso, the seat, the legs, the arms (then the clips, through clips), the fingers. The face is the frame's.
packages/micromotion/src/pose.ts:195
poseLevel function
function poseLevel: (l: MicroLod) => LodLevel | nullthe pose layer's level for a micro level (a crowd person is posed by the crowd's baked clips until he comes close; off is not posed)
packages/micromotion/src/lod.ts:53
poseOf function
function poseOf(rig: RigLike, pose: PoseLike, P: PersonState, o: PoseOfOptions): { baked: boolean; report: MicroPoseReport }One call for the frame: the near level is always live; the middle and far play the loop when the person may be shown by one, and are live otherwise. Returns what was done and the pose report (empty hand and foot errors for a loop).
packages/micromotion/src/bake.ts:126
poseThisFrame function
function poseThisFrame: (l: MicroLod, frame: number, phase?: number) => booleanpackages/micromotion/src/lod.ts:51
profile function
function profile(name: string): MicroProfilea copy of a shipped profile, ready to edit
packages/micromotion/src/profiles.ts:92
qangle function
function qangle: (q: ArrayLike<number>) => numberthe rotation angle of a quaternion, radians, 0..pi
packages/micromotion/src/math.ts:43
qaxis function
function qaxis: (axis: ArrayLike<number>, angle: number) => Quatpackages/micromotion/src/math.ts:26
qconj function
function qconj: (a: ArrayLike<number>) => Quatpackages/micromotion/src/math.ts:24
qmul function
function qmul: (a: ArrayLike<number>, b: ArrayLike<number>) => Quatpackages/micromotion/src/math.ts:18
qnorm function
function qnorm: (a: Quat) => Quatpackages/micromotion/src/math.ts:25
qrot function
function qrot: (q: ArrayLike<number>, v: ArrayLike<number>) => Vec3packages/micromotion/src/math.ts:30
qslerp function
function qslerp: (a: ArrayLike<number>, b: ArrayLike<number>, t: number) => Quatpackages/micromotion/src/math.ts:35
rateOf function
function rateOf(P: AiBody, h: HabitName): numberThe rate now, times a minute: the setting or the temperament's, the factor, and boredom (up to +60% as still nears the profile's maxStill).
packages/micromotion/src/ai.ts:97
reactionDelay function
function reactionDelay(r: ReactionName, s: Stream): numberthe time, s, between perceiving and the first motion: 150 to 300 ms, by the reaction
packages/micromotion/src/stimulus.ts:101
registerMicroCommands function
function registerMicroCommands(host: CommandHost, session: MicroSession = new MicroSession()): MicroSessionRegisters the micro.* commands on a host over a session. Returns the session.
packages/micromotion/src/service.ts:132
rnd function
function rnd(s: Stream): numberthe next number in [0, 1) of a stream (mulberry32)
packages/micromotion/src/rng.ts:15
rrange function
function rrange: (s: Stream, lo: number, hi: number) => numberpackages/micromotion/src/rng.ts:22
runRoutine function
function runRoutine(bridge: MotionBridgeLike, id: string, text: string, params: Record<string, unknown> = {}): unknownRuns a person's routine (a program of the motion language, text) with self bound to his id. Several people may run the same text: each has his own program.
packages/micromotion/src/motion.ts:86
saccade function
function saccade(seed: number, t: number): { yaw: number; pitch: number }the small jumps of the gaze (micro-saccades), radians
packages/micromotion/src/life.ts:83
sampleClipBone function
function sampleClipBone(clip: MotionClip, bone: number, t: number, out: Float32Array, at: number): voidthe local rotation of a clip's bone at time t (it holds the last frame), slerped between frames
packages/micromotion/src/clips.ts:129
sampleFeet function
function sampleFeet(g: Gesture, u: number, amp: number, t: number): SampledFoot[]The foot offsets of a gesture at progress u (metres, x out to the side of the foot); amp scales them, t is the gesture's clock for the swing.
packages/micromotion/src/gestures.ts:274
sampleHands function
function sampleHands(g: Gesture, u: number, amp: number, t: number): SampledHand[]The hand targets of a gesture at progress u. t is the gesture's clock in seconds (for the wobble).
packages/micromotion/src/gestures.ts:248
sampleKeys function
function sampleKeys(keys: [number, number][], u: number): numberthe value of a channel's curve at progress u (smooth between keys), degrees
packages/micromotion/src/gestures.ts:223
sampleRot function
function sampleRot(g: Gesture, u: number, amp: number, mirror: boolean): SampledRot[]The torso and head rotations of a gesture at progress u, amplitude amp (>= 0), for a dominant side (mirror for right-dominant: yaw and roll negate).
packages/micromotion/src/gestures.ts:237
say function
function say(P: PersonState, line: Line)A person is given a line: beats and nods fall on its stresses, and a shouted line raises the loudspeaker prop for its whole length.
packages/micromotion/src/sim.ts:296
screenHeightPx function
function screenHeightPx: (height: number, distance: number, fov: number, screenPx: number) => numbera person's height on the screen in pixels: his height, his distance, the vertical field of view and the screen's height in pixels
packages/micromotion/src/lod.ts:19
seedState function
function seedState: (seed: number, salt?: number) => numberthe state of a stream from a seed (never 0)
packages/micromotion/src/rng.ts:11
seenStrength function
function seenStrength(s: Stimulus, dist: number): numberand as seen: lights and movement carry far, and fall with the square of the distance past SIGHT_DIST
packages/micromotion/src/stimulus.ts:44
sessionFromManifest function
function sessionFromManifest(m: MicroManifest, o: MicroSessionOptions = {}): MicroSessionbuild a session from a manifest block
packages/micromotion/src/service.ts:221
setHabit function
function setHabit(P: AiBody, h: HabitName, o: { perMin?: number | null; rate?: number; amp?: number; enabled?: boolean }): HabitSettingpackages/micromotion/src/ai.ts:179
setMode function
function setMode(P: AiBody, mode: AiMode): voidpackages/micromotion/src/ai.ts:175
setTemperament function
function setTemperament(P: AiBody, patch: Partial<Temperament>): TemperamentChange the temperament while he lives: any of its six numbers, each 0..1. The habits' rates follow at once (they are read from it).
packages/micromotion/src/ai.ts:193
smooth01 function
function smooth01: (t: number) => numberpackages/micromotion/src/math.ts:9
startHabit function
function startHabit(P: AiBody, h: HabitName): ActiveHabit | nullBegin a habit now (an order, or its time). The size comes from the temperament and the setting; head turns go to a side chosen by the stream.
packages/micromotion/src/ai.ts:136
startRoutines function
function startRoutines(bridge: MotionBridgeLike, people: { id: string; routine?: string }[]): unknown[]Starts the routine of every person of a manifest block that has one. Returns the programs.
packages/micromotion/src/motion.ts:91
stepBlink function
function stepBlink(b: BlinkState, dt: number, now: number, s: Stream, nervousness: number, arousal: number): voidadvance the blink by dt at sim time now
packages/micromotion/src/life.ts:30
stepGaze function
function stepGaze(g: GazeFrame, want: GazeAim, dt: number): { bodyTurn: number }Advance the gaze by dt toward a target direction in the body frame (want, relative to where the body faces now). The eyes go first: they take what they can (within their limits)
of the angle left after the head's current turn; the head follows to a share of it; the chest takes what the head cannot comfortably; when the target stays beyond head and chest
for BODY_TURN_AFTER seconds the body turns, which returns bodyTurn (rad turned this step) for the caller to rotate the person by; the stages' angles are then relative to the new facing.
packages/micromotion/src/gaze.ts:106
stepHabits function
function stepHabits(P: AiBody, dt: number): HabitName[]One step of the habits. Returns the names begun in this step (the sim notes them). The blink is not here: the life layer plays it and the sim applies blinkSetting.
packages/micromotion/src/ai.ts:150
stepPerson function
function stepPerson(P: PersonState, dt: number, w: MicroWorld = EMPTY_WORLD): voidAdvance one person by dt seconds (the fixed step).
packages/micromotion/src/sim.ts:311
stimulusOfEvent function
function stimulusOfEvent(e: BusEvent, now: number): Stimulus | nullThe stimulus of a bus event of the physics and vfx modules (explosion:blast, physics:impact, physics:break, combustion:out, vfx:ignite, vfx:out), or of a game event
(take:start, take:cut, scene:good, scene:bad, micro:stimulus), at the sim time now. Null for any other event.
packages/micromotion/src/stimulus.ts:112
stressTimes function
function stressTimes(line: Line): number[]The times of the stresses of a line: from the text (a word of four letters or more, a word ending in ! or ?, a word in capitals; placed at the middle of the word in the line's time by the characters before it) or the given ones; sorted, and thinned to MIN_BEAT_GAP.
packages/micromotion/src/speech.ts:28
swayAt function
function swayAt(seed: number, t: number, energy: number, nervousness: number, sit: number): Swaythe standing person's slow shifts of the pelvis and spine (radians, metres): a sum of slow noises, less when seated; more for an energetic or nervous person
packages/micromotion/src/life.ts:58
swing function
function swing(a: Vec3, b: Vec3): Quatthe shortest rotation taking direction a to direction b
packages/micromotion/src/pose.ts:151
vadd function
function vadd: (a: Vec3, b: Vec3) => Vec3packages/micromotion/src/math.ts:12
validateMicroManifest function
function validateMicroManifest(m: unknown): { path: string; message: string }[]packages/micromotion/src/service.ts:204
validateProfile function
function validateProfile(p: unknown): Issue[]packages/micromotion/src/profile.ts:74
vdot function
function vdot: (a: Vec3, b: Vec3) => numberpackages/micromotion/src/math.ts:15
vlen function
function vlen: (a: Vec3) => numberpackages/micromotion/src/math.ts:14
vmul function
function vmul: (a: Vec3, k: number) => Vec3packages/micromotion/src/math.ts:13
vsub function
function vsub: (a: Vec3, b: Vec3) => Vec3packages/micromotion/src/math.ts:11
vunit function
function vunit: (a: Vec3) => Vec3packages/micromotion/src/math.ts:16
walkTo function
function walkTo(P: PersonState, pos: Vec3): voidOrder him to walk to a place on the floor; it becomes his home on arrival (he stands up first if he is seated). A walk about the old home in progress is dropped.
packages/micromotion/src/sim.ts:282
withHysteresis function
function withHysteresis(prev: MicroLod | undefined, next: MicroLod, held: number, frames = 20): { level: MicroLod; held: number }a change of level takes this many frames of hysteresis so a person on the edge does not flicker
packages/micromotion/src/lod.ts:55
wrapPi function
function wrapPi: (a: number) => numberpackages/micromotion/src/math.ts:10
Interfaces
ActiveActivity interface
interface ActiveActivitydef: ActivityDef | |
gesture: Gesture | null | |
t: number | |
dur: number | |
amp: number | |
legs: Vec3[] | |
leg: number | |
pause: number | |
rehome?: Vec3 | when the walk ends, this point becomes his home (a walk ordered to a place) |
packages/micromotion/src/sim.ts:27
ActiveBeat interface
interface ActiveBeatg: Gesture | |
kind: 'beat' | 'nod' | |
t: number | |
dur: number | |
amp: number |
packages/micromotion/src/sim.ts:30
ActiveHabit interface
interface ActiveHabitpackages/micromotion/src/ai.ts:47
ActiveReaction interface
interface ActiveReactiondef: ReactionDef | |
gesture: Gesture | null | |
t: number | |
dur: number | |
amp: number | |
strength: number |
packages/micromotion/src/sim.ts:29
ActivityDef interface
interface ActivityDefid: string | |
gesture?: string | |
special?: 'walk' | 'sit-down' | 'stand-up' | |
posture: PostureName | 'any' | |
prop?: string | |
take?: 'running' | 'idle' | 'any' | |
cool: number | |
energy: number | |
arousal?: number | what the activity does to arousal (added, 0..1) |
packages/micromotion/src/activities.ts:8
AiBody interface
interface AiBodywhat the AI needs of a person: the sim's PersonState has all of this
t: number | |
posture: PostureName | |
trans: object | null | |
reaction: object | null | |
activity: { gesture: Gesture | null } | null | |
speed: number | |
still: number | |
arousal: number | |
profile: MicroProfile | |
ai: AiState | |
habits: ActiveHabit[] | |
blink: { next: number; t: number } |
packages/micromotion/src/ai.ts:67
AiOrder interface
interface AiOrdername: string | |
dur?: number |
packages/micromotion/src/ai.ts:48
AiState interface
interface AiStaters: number | |
mode: AiMode | |
habits: Record<HabitName, HabitSetting> | |
due: Record<HabitName, number> | the sim time at which each habit is next due |
queue: AiOrder[] | orders to carry out as soon as he is free: an activity or a habit |
goto: Vec3 | null | a place to walk to, and whether he has arrived (the count of arrivals, for a program that waits) |
arrivals: number | |
count: Record<HabitName, number> | the habits begun, by name (a diagnostic) |
chair: { home: Vec3; seat: NonNullable<MicroProfile['anchors']['seat']> } | null | the chair he was given: where it stands and what it is like; it stays there when he walks off, and he can sit again only at it |
packages/micromotion/src/ai.ts:49
Anchors interface
interface Anchorshome: Vec3 | the home point on the floor [x, y, z], metres, and the way the person faces there (yaw, radians, 0 = +z, positive toward +x) |
facing: number | |
seat?: { height: number; back: boolean; armrests: boolean } | a seat: the seat's height above the floor, metres, and whether it has a back and armrests |
radius: number | how far from home the person walks about, metres |
packages/micromotion/src/profile.ts:31
BakedLoop interface
interface BakedLoopposture: 'stand' | 'sit' | |
duration: number | seconds, and frames per second |
fps: number | |
frames: number | |
bones: string[] | bone names, and frames bones 4 local rotations |
rot: Float32Array | |
pelvis: Float32Array | the pelvis position per frame: frames * 3 |
packages/micromotion/src/bake.ts:21
BakedPerson interface
interface BakedPersonpackages/micromotion/src/bake.ts:30
BakeOptions interface
interface BakeOptionsseconds?: number | seconds in the loop (default 40: long enough that the repeat is not noticed from far) |
fps?: number | frames per second recorded (default 15) |
fade?: number | seconds of the tail blended into the head to close the loop (default 1.5) |
lod?: LodLevel | the level the pose is solved at while recording (default 'middle': arms and legs, no fingers) |
seatHeight?: number |
packages/micromotion/src/bake.ts:32
BeatEvent interface
interface BeatEventstart: number | when the gesture starts, s from the start of the line (it may be before 0 for a stress at the very start: clamped to 0) |
stress: number | when its stroke lands, s from the start of the line: the stress |
kind: 'beat' | 'nod' |
packages/micromotion/src/speech.ts:16
BlinkState interface
interface BlinkStatenext: number | sim time of the next blink, s |
t: number | time since this blink began, s; negative: not blinking |
twice: boolean | a second blink follows this one |
packages/micromotion/src/life.ts:9
BusEvent interface
interface BusEventname: string | |
payload: any |
packages/micromotion/src/stimulus.ts:107
BusLike interface
interface BusLikeon(name: string, fn: (payload: any) => void): () => void |
packages/micromotion/src/service.ts:17
Channel interface
interface Channelpitch: about +x (positive leans a bone that points up toward +z: the chest forward, the chin down); yaw: about +y (toward the person's left); roll: about +z (toward the right)
bone: string | |
axis: Axis | |
keys: [number, number][] |
packages/micromotion/src/gestures.ts:10
ClipPlay interface
interface ClipPlayhow a clip is played: a variant by the seed, the person's hand, a speed and an amplitude, the style of his profile
clip: MotionClip | |
mirror: boolean | |
speed: number | |
amp: number | |
fade: number | blend in and out, seconds |
packages/micromotion/src/clips.ts:29
CommandHost interface
interface CommandHostregister(name: string, description: string, fn: (args: any) => unknown | Promise<unknown>): void |
packages/micromotion/src/service.ts:16
FootTrack interface
interface FootTrackA foot's offset from where the pose has it (a seated person's foot on the floor, a standing person's foot planted): x out to the side of the foot, y up, z forward, metres; keys [u, x, y, z]; wob swings it while held.
side: 'd' | 'o' | |
keys: [number, number, number, number][] | |
wob?: { hz: number; d: [number, number, number]; from: number; to: number } |
packages/micromotion/src/gestures.ts:19
FrameHand interface
interface FrameHandside: 'l' | 'r' | |
pos: Vec3 | |
w: number | |
ownsProp: boolean |
packages/micromotion/src/frame.ts:14
FrameOptions interface
interface FrameOptionslod?: LodLevel | |
time: number | |
seed: number | |
seatHeight?: number | |
skip?: (g: GestureOut) => boolean |
packages/micromotion/src/frame.ts:29
FrameProp interface
interface FramePropside: 'l' | 'r' | |
at: Vec3 |
packages/micromotion/src/frame.ts:15
FrameRot interface
interface FrameRotbone: string | |
axis: FrameAxis | |
rad: number |
packages/micromotion/src/frame.ts:13
GazeAim interface
interface GazeAimyaw: number | |
pitch: number |
packages/micromotion/src/gaze.ts:78
GazeChoice interface
interface GazeChoiceid: string | null | |
score: number |
packages/micromotion/src/gaze.ts:19
GazeFrame interface
interface GazeFrameeyes: GazeAim | |
head: GazeAim | |
chest: GazeAim | |
bodyYaw: number | the body's turn so far from where it started, radians (the whole person turns by this much) |
beyond: number | the time the target has been beyond what head and chest reach, s |
headV: GazeAim | how fast the head and the chest are turning now, rad/s |
chestV: number |
packages/micromotion/src/gaze.ts:79
GazeParams interface
interface GazeParamsmaxFixation: number | the longest the gaze stays on one target, s, at focus 1 (a lower focus shortens it) |
glancesPerMin: number | glances away per minute |
packages/micromotion/src/profile.ts:39
GazeTarget interface
interface GazeTargetid: string | |
pos: Vec3 | |
tags: string[] | |
speed?: number | its speed, m/s (movement in view draws the eye) |
loud?: number | loudness 0..1 |
speaking?: boolean |
packages/micromotion/src/gaze.ts:9
Gesture interface
interface Gestureid: string | |
dur: [number, number] | seconds: [min, max] |
rot: Channel[] | |
hands: HandTrack[] | |
prop?: { name: string; mode: 'rest' | 'use' } | the prop mode this gesture asks for (a loudspeaker or a camera in hand: use; none: leave it) |
shift?: [number, number, number][] | a pelvis shift (x to the side, z forward, metres) over the gesture, and the root's sway of the weight |
feet?: FootTrack[] | offsets of the feet (a leg swung, a foot tapped, the unloaded foot lifted when the weight goes to the other) |
packages/micromotion/src/gestures.ts:24
GestureOut interface
interface GestureOutkind: 'activity' | 'reaction' | 'beat' | 'nod' | 'habit' | |
g: Gesture | |
u: number | |
t: number | |
amp: number |
packages/micromotion/src/sim.ts:34
HabitDef interface
interface HabitDefid: HabitName | |
gesture: string | null | the gesture it plays (null: the blink, which the life layer plays) |
posture: PostureName | 'any' | where it can be done |
group: 'legs' | 'head' | 'eyes' | habits of one group do not run together (two things with the legs at once) |
packages/micromotion/src/ai.ts:19
HabitSetting interface
interface HabitSettingthe settings of a habit (the profile gives the first ones; micro.habit changes them)
perMin?: number | times a minute, overriding the rate the temperament gives (undefined: from the temperament) |
rate: number | a factor on the rate, whatever its source |
amp: number | a factor on the size of the motion |
enabled: boolean |
packages/micromotion/src/ai.ts:37
HandTrack interface
interface HandTrackside: 'd' | 'o' | |
keys: HandKey[] | |
wob?: { hz: number; d: [number, number, number]; from: number; to: number } | a wobble while the hand is held: frequency Hz and the displacement in metres along x, y, z, over the span [from, to] of the gesture's progress |
packages/micromotion/src/gestures.ts:12
Issue interface
interface Issuepath: string | |
message: string |
packages/micromotion/src/profile.ts:69
Line interface
interface Linetext?: string | the words (optional when stresses are given) |
duration: number | how long it lasts, s |
stresses?: number[] | the times of the stressed moments, s from the start of the line; derived from the text when absent |
shout?: boolean | shouted through a loudspeaker prop (raised for the whole line) |
packages/micromotion/src/speech.ts:6
LodBudget interface
interface LodBudgetnear: number | most people posed at the near level / near and middle together |
nearMiddle: number |
packages/micromotion/src/lod.ts:12
LodInput interface
interface LodInputid: string | |
px: number | |
visible?: boolean |
packages/micromotion/src/lod.ts:32
LodThresholds interface
interface LodThresholdsnear: number | the person's height on the screen, pixels, from which each level is used |
middle: number | |
far: number |
packages/micromotion/src/lod.ts:7
LogEntry interface
interface LogEntryt: number | |
kind: 'activity' | 'reaction' | 'posture' | 'stimulus' | 'beat' | 'glance' | 'walk' | 'habit' | 'order' | |
id: string |
packages/micromotion/src/sim.ts:32
MicroFrame interface
interface MicroFramelod: LodLevel | |
sit: number | |
seatHeight: number | |
mirror: boolean | |
sway: { roll: number; yaw: number; shiftX: number; shiftZ: number } | |
breath: number | the chest's breath in radians, and the clavicle's, signed for the left |
breathClavicle: number | |
head: { yaw: number; pitch: number } | |
chestYaw: number | |
rot: FrameRot[] | |
hands: FrameHand[] | |
props: FrameProp[] | |
feet: { l: Vec3; r: Vec3 } | offsets of the feet from where the pose has them, metres (x out to the side of the foot, y up, z forward) |
curl: number[] | the finger curl 0..1 of each finger: side * 4 + finger (index, middle, ring, pinky) |
face: FaceWeights |
packages/micromotion/src/frame.ts:16
MicroManifest interface
interface MicroManifestpeople?: MicroManifestPerson[] | |
targets?: (GazeTarget & { id: string })[] | |
take?: 'idle' | 'running' |
packages/micromotion/src/service.ts:203
MicroManifestPerson interface
interface MicroManifestPersonroutine: a program of the motion language run for this person when the level loads (self is his id; see motion.ts)
id: string | |
profile: string | MicroProfile | |
seed?: number | |
pos?: Vec3 | |
facing?: number | |
routine?: string |
packages/micromotion/src/service.ts:202
MicroOut interface
interface MicroOutposture: PostureName | |
sit: number | 0 standing .. 1 seated, through the change |
gestures: GestureOut[] | |
props: Record<string, number> | each prop in the profile: 0 at rest .. 1 in use |
gaze: { eyes: GazeAim; head: GazeAim; chest: GazeAim; bodyYaw: number; target: string | null; blink: number; glancing: boolean } | |
moving: boolean | |
speed: number | |
arousal: number |
packages/micromotion/src/sim.ts:35
MicroPerson interface
interface MicroPersonstate: PersonState | |
lod: MicroLod | |
held: number | |
seen: number |
packages/micromotion/src/service.ts:19
MicroPoseOptions interface
interface MicroPoseOptionslod?: LodLevel | |
time: number | the sim clock for the life layers' time, s |
seed: number | |
seatHeight?: number | the seat's height, m (default 0.47) |
clips?: ClipBank | clips for gestures: a gesture with a clip here is played by the clip (a masked layer), the rest by the module's curves |
packages/micromotion/src/pose.ts:21
MicroPoseReport interface
interface MicroPoseReportface: FaceWeights | |
handError: { l: number; r: number } | how far each hand ended from the target it was given, m (0 when it had none) |
footError: { l: number; r: number } | how far each foot ended from where it stood, m (a seated person's feet go to the floor in front, so it is measured from that target) |
maxTurn: number | the largest turn any joint was given, degrees |
packages/micromotion/src/pose.ts:31
MicroProfile interface
interface MicroProfilename: string | |
role: string | |
temperament: Temperament | |
handedness: 'left' | 'right' | |
repertoire: Record<string, number> | activity name -> weight (> 0); every name is in ACTIVITIES |
props: Record<string, PropSpec> | |
anchors: Anchors | |
interests: Record<string, number> | target tag -> how much it raises salience for this person (0..3) |
reactions: Partial<Record<StimulusKind, Partial<Record<ReactionName, number>>>> | stimulus kind -> reaction -> weight; a kind that is missing does not move the person (a glance only) |
gaze: GazeParams | |
maxStill: number | the longest time, s, in which nothing but the life layers moves the person |
seated?: boolean | starts seated |
habits?: HabitSettings | the settings of his habits: how often he swings a leg, turns his head, shifts his weight, blinks (the rest come from the temperament) |
mode?: AiMode | the AI mode he starts in (default 'auto') |
packages/micromotion/src/profile.ts:45
MicroSessionOptions interface
interface MicroSessionOptionsthresholds?: LodThresholds | |
budget?: LodBudget | |
occluded?: MicroWorld['occluded'] |
packages/micromotion/src/service.ts:22
MicroWorld interface
interface MicroWorldtargets: readonly GazeTarget[] | what there is to look at |
take?: 'idle' | 'running' | a scene is running (the one in charge shouts, the one with a camera follows the action) |
occluded?: (from: Vec3, to: Vec3) => boolean | the line is blocked (smoke, a wall) |
packages/micromotion/src/sim.ts:17
MotionBridgeLike interface
interface MotionBridgeLikethe part of MotionBridge (@ferret/motion) this link uses
define(name: string, sig: { args: string[]; min?: number; rest?: string; returns?: string }, fn: (ctx: unknown, ...args: any[]) => unknown): unknown | |
lasting(name: string, sig: { args: string[]; min?: number; rest?: string; returns?: string }, fn: (ctx: unknown, ...args: any[]) => { done(): boolean; result?: unknown }): unknown | |
run(program: string | unknown, params?: Record<string, unknown>): unknown | |
readonly rt: { deliver(name: string, payload?: unknown): void } |
packages/micromotion/src/motion.ts:27
MotionClip interface
interface MotionClipid: string | |
duration: number | seconds |
fps: number | |
frames: number | |
bones: string[] | the bones the clip drives, and their local rotations per frame: frames bones.length 4 |
rot: Float32Array | |
plays: string[] | the gestures it can play (ids of GESTURES or reactions), e.g. point, megaphone-shout, cheer |
dominant?: 'l' | 'r' | the clip is made for a left-dominant (the module's frame) or a right-dominant person; the other is got by mirroring |
amplitude?: number | the clip's own look: how large and how quick it is as made (1 = as made) |
packages/micromotion/src/clips.ts:11
NewPersonOptions interface
interface NewPersonOptionspos?: Vec3 | |
facing?: number | |
external?: boolean |
packages/micromotion/src/sim.ts:106
Observer interface
interface Observerpos: Vec3 | |
facing: Vec3 | the direction the head faces, a unit vector in the world |
fov?: number | half the field of view of the eyes, radians (default 100 degrees) |
packages/micromotion/src/stimulus.ts:48
Perceived interface
interface Perceivedarrive: number | the sim time when it reaches him: the sound's delay for the distance, the light at once |
strength: number | |
dir: Vec3 | null | a unit vector from him to the source (null for a stimulus with no place) |
by: 'sight' | 'hearing' | 'told' |
packages/micromotion/src/stimulus.ts:55
PersonState interface
interface PersonStateid: string | |
profile: MicroProfile | |
seed: number | |
rs: number | |
t: number | sim clock, s |
posture: PostureName | |
trans: { to: PostureName; t: number; total: number } | null | |
pos: Vec3 | |
facing: number | yaw in the world, radians, 0 = +z, positive toward +x |
external: boolean | the game moves the person (a NavAgent); the sim then does not integrate walks |
activity: ActiveActivity | null | |
reaction: ActiveReaction | null | |
beats: ActiveBeat[] | |
nextAt: number | |
cool: Record<string, number> | |
recent: string[] | |
fatigue: number | |
arousal: number | |
pending: Pending[] | |
line: { line: Line; t: number; plan: BeatEvent[]; next: number } | null | |
gaze: { frame: GazeFrame; target: string | null; since: number; tick: number; glanceUntil: number; glanceTo: GazeAim; nextGlance: number; glances: number; event: { dir: Vec3; until: number } | null; idle: GazeAim; lastWant: GazeAim; } | |
blink: BlinkState | |
still: number | time since anything but the life layers moved him, s |
propBlend: Record<string, number> | |
speed: number | |
longestDwell: number | the longest the gaze has stayed on one target without a glance, s (a diagnostic) |
log: LogEntry[] | |
logN: number | how many log entries there have been in all (the log keeps the last ones) |
ai: AiState | his own AI: mode, habits, orders (see ai.ts), and the habits under way |
habits: ActiveHabit[] | |
releasing: { kind: GestureOut['kind']; g: Gesture; u: number; t: number; amp: number; age: number }[] | gestures taken away before their end (a reaction cuts the activity, a stronger reaction the weaker one, an ordered habit the one of its group): each goes on being drawn where it was cut, its amplitude going to nothing over RELEASE seconds, so a body part never jumps back to rest in one frame |
out: MicroOut |
packages/micromotion/src/sim.ts:48
PoseLike interface
interface PoseLikeq: Float32Array | |
pelvis: [number, number, number] |
packages/micromotion/src/pose.ts:20
PoseOfOptions interface
interface PoseOfOptionslod: LodLevel | |
time: number | |
seed: number | |
seatHeight?: number | |
baked?: BakedPerson |
packages/micromotion/src/bake.ts:121
PropSpec interface
interface PropSpechand: 'd' | 'o' | 'both' | the hand that holds it (the dominant one by default) |
socket: string | the socket (a bone name) it hangs on when not in hand |
rest: [number, number, number][] | hand targets from the shoulder, left-dominant frame, metres at the reference arm length (see gestures.ts), at rest and in use; [d, o] hands |
use: [number, number, number][] |
packages/micromotion/src/profile.ts:24
ReactionDef interface
interface ReactionDefid: ReactionName | |
gesture: string | null | the gesture it plays (null: no gesture of its own, the posture or the gaze does it) |
arousal: number | how much it adds to arousal at strength 1 |
look: boolean | the gaze goes to the source of the stimulus |
stand?: boolean | the person gets to his feet |
delay: [number, number] | the first motion comes this soon after the stimulus is perceived: [min, max] seconds (the plan's 150-300 ms) |
packages/micromotion/src/activities.ts:52
RigLike interface
interface RigLiken: number | |
names: string[] | |
index: Map<string, number> | |
parent: Int16Array | |
restQ: Float32Array | |
restWorldQ: Float32Array | |
tLocal: Float32Array | |
restWorld: Float32Array | |
legScale: number |
packages/micromotion/src/pose.ts:17
SampledFoot interface
interface SampledFootside: 'd' | 'o' | |
pos: [number, number, number] |
packages/micromotion/src/gestures.ts:272
SampledHand interface
interface SampledHandside: 'd' | 'o' | |
pos: [number, number, number] | null | |
w: number |
packages/micromotion/src/gestures.ts:234
SampledRot interface
interface SampledRotbone: string | |
axis: Axis | |
rad: number |
packages/micromotion/src/gestures.ts:233
Stimulus interface
interface Stimuluskind: StimulusKind | |
at: Vec3 | null | where it happened; null: the whole set hears it (a scene starting, a shout by the one in charge) |
size: number | its size at the source, 0..1.4 (a blast's follows its TNT equivalent, an impact's its impulse) |
t0: number | the sim clock when it happened, s |
sound: boolean | can it be heard / seen |
sight: boolean | |
note?: string | what it is, for the log |
packages/micromotion/src/stimulus.ts:12
Stream interface
interface Streamrs: number |
packages/micromotion/src/rng.ts:13
Sway interface
interface Swayroll: number | |
yaw: number | |
shiftX: number | |
shiftZ: number |
packages/micromotion/src/life.ts:56
Temperament interface
interface Temperamentenergy: number | how often and how wide the motions are |
nervousness: number | fidget rate, short attention span, tremor |
expansiveness: number | the size of gestures, how far from the body |
dominance: number | an upright stance, pointing at others |
focus: number | how long attention stays on one thing |
mood: number | 0 gloomy .. 1 cheerful: the face at rest and the reactions |
packages/micromotion/src/profile.ts:16
Types
AiMode type
type AiMode = 'auto' | 'habits' | 'off'packages/micromotion/src/profile.ts:11
Axis type
type Axis = 'pitch' | 'yaw' | 'roll'packages/micromotion/src/gestures.ts:8
FaceWeights type
type FaceWeights = Record<string, number>packages/micromotion/src/life.ts:7
FrameAxis type
type FrameAxis = 0 | 1 | 2packages/micromotion/src/frame.ts:12
HabitName type
type HabitName = 'leg-swing' | 'foot-tap' | 'head-turn' | 'weight-shift' | 'blink'packages/micromotion/src/profile.ts:9
HabitSettings type
type HabitSettings = Partial<Record<HabitName, { perMin?: number; rate?: number; amp?: number; enabled?: boolean }>>the settings of the habits of a person (see ai.ts): perMin fixes the rate, rate and amp are factors, enabled false switches it off
packages/micromotion/src/profile.ts:14
HandKey type
type HandKey = [number, number, number, number] | [number, 'rest']packages/micromotion/src/gestures.ts:11
LodLevel type
type LodLevel = 'near' | 'middle' | 'far'the levels the pose layer knows
packages/micromotion/src/lod.ts:5
MicroListener type
type MicroListener = (name: string, id: string) => voidwhat the session announces: micro:activity, micro:reaction, micro:posture, micro:habit, micro:walk, micro:arrived, micro:refused, micro:removed; the argument is the person's id
packages/micromotion/src/service.ts:21
MicroLod type
type MicroLod = LodLevel | 'crowd' | 'off'packages/micromotion/src/lod.ts:6
PostureName type
type PostureName = 'stand' | 'sit'packages/micromotion/src/activities.ts:7
Quat type
type Quat = [number, number, number, number]packages/micromotion/src/math.ts:4
ReactionName type
type ReactionName = 'flinch' | 'startle' | 'duck' | 'turn-look' | 'stand-up' | 'cheer' | 'applaud' | 'despair' | 'anger'packages/micromotion/src/activities.ts:51
StimulusKind type
type StimulusKind = 'blast' | 'impact' | 'break' | 'fire' | 'fire-out' | 'shot' | 'speech' | 'take-start' | 'take-cut' | 'scene-good' | 'scene-bad' | 'custom'packages/micromotion/src/profile.ts:6
Vec3 type
type Vec3 = [number, number, number]packages/micromotion/src/math.ts:3
Constants
ACTIVITIES const
const ACTIVITIES: Record<string, ActivityDef>packages/micromotion/src/activities.ts:22
AI_MODES const
const AI_MODES: AiMode[]packages/micromotion/src/profile.ts:12
BAKE_BONES const
const BAKE_BONES: string[]the bones a loop records: those the pose layer turns (the fingers and the face are near-level only)
packages/micromotion/src/bake.ts:18
BEAT_PEAK const
const BEAT_PEAK: 0.4the progress u at which a beat gesture's stroke lands (a speech stress is aligned to it)
packages/micromotion/src/gestures.ts:217
BLINK_CLOSE const
const BLINK_CLOSE: 0.06packages/micromotion/src/life.ts:19
BLINK_OPEN const
const BLINK_OPEN: 0.14packages/micromotion/src/life.ts:19
BODY_TURN_AFTER const
const BODY_TURN_AFTER: 0.9the time, s, the target must be out of reach of head and chest before the body turns
packages/micromotion/src/gaze.ts:76
BONE_LIMITS const
const BONE_LIMITS: Record<string, number>the comfort limits of a rotation channel's bone, degrees (a gesture's value is clamped to them)
packages/micromotion/src/gestures.ts:220
DEFAULT_BUDGET const
const DEFAULT_BUDGET: LodBudgetpackages/micromotion/src/lod.ts:16
DEFAULT_THRESHOLDS const
const DEFAULT_THRESHOLDS: LodThresholdspackages/micromotion/src/lod.ts:11
EMPTY_WORLD const
const EMPTY_WORLD: MicroWorldpackages/micromotion/src/sim.ts:25
GAZE_LIMITS const
const GAZE_LIMITS: { eyes: { yaw: number; up: number; down: number; }; head: { yaw: number; up: number; down: number; }; chest: { yaw: number; }; headComfort: number; }the limits of each stage, radians
packages/micromotion/src/gaze.ts:63
GAZE_SPEED const
const GAZE_SPEED: { eyes: number; head: number; chest: number; body: number; headMax: number; chestMax: number; bodyMax: number; }how fast each stage follows, 1/s (the eyes jump in about a tenth of a second) and the most it turns, rad/s
packages/micromotion/src/gaze.ts:71
GAZE_SPRING const
const GAZE_SPRING: { head: number; chest: number; }the head and the chest are heavy: they speed up into a turn and slow down out of it (a critically damped follow of this natural frequency, rad/s), never starting at full speed in one frame as a first-order follow would; the eyes, light, jump (a saccade)
packages/micromotion/src/gaze.ts:74
GESTURES const
const GESTURES: Record<string, Gesture>packages/micromotion/src/gestures.ts:48
HABIT_NAMES const
const HABIT_NAMES: HabitName[]packages/micromotion/src/profile.ts:10
HABITS const
const HABITS: Record<HabitName, HabitDef>packages/micromotion/src/ai.ts:28
HEARING_THRESHOLD const
const HEARING_THRESHOLD: 0.04packages/micromotion/src/stimulus.ts:31
MIN_BEAT_GAP const
const MIN_BEAT_GAP: 0.45the least time between two stresses that get a gesture, s (a hand cannot chop faster and look natural)
packages/micromotion/src/speech.ts:24
MIN_STRENGTH const
const MIN_STRENGTH: Record<ReactionName, number>the least strength at which a reaction is possible (a ducking man needs a loud thing)
packages/micromotion/src/stimulus.ts:87
POSE_EVERY const
const POSE_EVERY: Record<MicroLod, number>How often a level is posed, in frames (the sim is not affected): the far ones every few frames, the off ones never.
packages/micromotion/src/lod.ts:50
PROFILE_NAMES const
const PROFILE_NAMES: string[]packages/micromotion/src/profiles.ts:97
PROFILES const
const PROFILES: Record<string, MicroProfile>packages/micromotion/src/profiles.ts:16
QI const
const QI: Quatpackages/micromotion/src/math.ts:6
REACTIONS const
const REACTIONS: Record<ReactionName, ReactionDef>packages/micromotion/src/activities.ts:65
RELEASE const
const RELEASE: 0.3how long a cut gesture takes to let go, s
packages/micromotion/src/sim.ts:95
restPose const
const restPose: (rig: RigLike) => PoseLikea fresh rest pose of a rig (a pose to build on when there is no clip)
packages/micromotion/src/pose.ts:287
SALIENCE const
const SALIENCE: { tag: number; speed: number; loud: number; speaking: number; near: number; noise: number; dwellPenalty: number; event: number; }the weight of each source of salience
packages/micromotion/src/gaze.ts:22
SPEED_OF_SOUND const
const SPEED_OF_SOUND: 343packages/micromotion/src/stimulus.ts:10
STIMULUS_EVENTS const
const STIMULUS_EVENTS: readonly ["explosion:blast", "physics:impact", "physics:break", "combustion:out", "vfx:ignite", "vfx:out", "take:start", "take:cut", "scene:good", "scene:bad", "micro:stimulus"]the bus events a service listens to
packages/micromotion/src/stimulus.ts:136
STIMULUS_KINDS const
const STIMULUS_KINDS: StimulusKind[]packages/micromotion/src/profile.ts:7