| name | turn-and-face |
| description | Rotates the whole body in place to a new heading using root.faceDeg — turning left/right, turning around, spinning, or facing a direction or location. Use whenever a command mentions turn (around/left/right), spin, rotate the body, face/turn toward something, or about-face. (For head-only looks use `move-head-and-neck`; for walking somewhere use `walk`.) |
| category | locomotion |
| disable-model-invocation | true |
turn-and-face
Atomic primitive that rotates the entire character about the vertical axis by
setting root.faceDeg (degrees). This turns the feet/whole body, not just the
head.
Heading convention
faceDeg is an ABSOLUTE heading: 0 = facing world +Z (the default forward),
90 = facing +X (its right), 180 = facing −Z (behind), −90 = facing −X
(its left). The character's CURRENT heading is in state.faceDeg — compute the
new absolute heading from it for relative turns:
- turn right 90° →
faceDeg = state.faceDeg + 90
- turn left 90° →
faceDeg = state.faceDeg − 90
- turn around / about-face →
faceDeg = state.faceDeg + 180
(Any value works; keeping it within −180..180 or 0..360 is fine.)
How to emit
- Turn in place: top-level
root:{ "faceDeg": <heading> }.
- Turn while/after moving to a place: put it on the move —
moveTo:{ "target":"<loc>", "faceDeg":<heading> }.
- Give a turn a moment:
durationMs ~ 600–1200 (longer for a full spin).
Worked Actions (assume state.faceDeg = 0 unless noted)
- "turn around" →
{"durationMs":900,"root":{"faceDeg":180},"say":"Turning around."}
- "turn to your right" →
{"durationMs":700,"root":{"faceDeg":90}}
- "turn left" (if
state.faceDeg was 90) →
{"durationMs":700,"root":{"faceDeg":0}}
- "spin around" → animate it with a
sequence of root headings:
{"durationMs":1600,"sequence":{"loop":false,"frames":[{"t":0,"root":{"faceDeg":0}},{"t":0.5,"root":{"faceDeg":180}},{"t":1,"root":{"faceDeg":360}}]},"say":"Wheee!"}
Notes
To FACE a named location without walking there, turn toward it (compute the
heading from the character's position to the location if known) or simply use
move-head-and-neck/lookAt for a gaze. To both go there and end facing a way,
use walk with moveTo.faceDeg. Keep at least the feet planted during a pure
turn.