wired:agent
Local user camera, avatar bones, body-attached documents, and viewport.
Interface local
Uses transform, error, document.
humanoid-bone
Standard VRM 1.0 humanoid bones.
hips | |
spine | |
chest | |
upper-chest | |
neck | |
head | |
left-eye | |
right-eye | |
jaw | |
left-shoulder | |
left-upper-arm | |
left-lower-arm | |
left-hand | |
right-shoulder | |
right-upper-arm | |
right-lower-arm | |
right-hand | |
left-upper-leg | |
left-lower-leg | |
left-foot | |
left-toes | |
right-upper-leg | |
right-lower-leg | |
right-foot | |
right-toes | |
left-thumb-proximal | |
left-thumb-intermediate | |
left-thumb-distal | |
left-index-proximal | |
left-index-intermediate | |
left-index-distal | |
left-middle-proximal | |
left-middle-intermediate | |
left-middle-distal | |
left-ring-proximal | |
left-ring-intermediate | |
left-ring-distal | |
left-little-proximal | |
left-little-intermediate | |
left-little-distal | |
right-thumb-proximal | |
right-thumb-intermediate | |
right-thumb-distal | |
right-index-proximal | |
right-index-intermediate | |
right-index-distal | |
right-middle-proximal | |
right-middle-intermediate | |
right-middle-distal | |
right-ring-proximal | |
right-ring-intermediate | |
right-ring-distal | |
right-little-proximal | |
right-little-intermediate | |
right-little-distal |
attachment
camera | |
body | World-aligned agent position (tracks translation without rotating with heading or head). |
bone(humanoid-bone) |
screen
Desktop viewport geometry.
width: u32 | Width in pixels. |
height: u32 | Height in pixels. |
fov: f32 | Vertical field of view in radians. |
camera-transform
Camera transform this frame in the calling script's document frame. Fails
with not-ready until the user's agent spawns (does not wait for avatar
loading).
bone-transform
bone-transform: func(bone: humanoid-bone) -> result<option<transform>, error>Bone transform this frame in the calling script's document frame, or
none if the avatar lacks that bone. Fails with not-ready until the
avatar finishes loading.
attach
attach: func(document: borrow<document>, to: attachment, offset: transform) -> result<_, error>Attaches a writable document at offset relative to the camera, body, or
a bone (local only). Detach by calling wired:scene/document.place.
Applies the same offset validation as place.
viewport
Desktop viewport dimensions and vertical FOV, or none in VR. Fails with
forbidden unless the local user authors the calling script's document.
Source
/// Local user camera, avatar bones, body-attached documents, and viewport.
package wired:agent;
interface local {
use wired:core/math.{transform};
use wired:core/error.{error};
use wired:scene/document.{document};
/// Standard VRM 1.0 humanoid bones.
enum humanoid-bone {
hips,
spine,
chest,
upper-chest,
neck,
head,
left-eye,
right-eye,
jaw,
left-shoulder,
left-upper-arm,
left-lower-arm,
left-hand,
right-shoulder,
right-upper-arm,
right-lower-arm,
right-hand,
left-upper-leg,
left-lower-leg,
left-foot,
left-toes,
right-upper-leg,
right-lower-leg,
right-foot,
right-toes,
left-thumb-proximal,
left-thumb-intermediate,
left-thumb-distal,
left-index-proximal,
left-index-intermediate,
left-index-distal,
left-middle-proximal,
left-middle-intermediate,
left-middle-distal,
left-ring-proximal,
left-ring-intermediate,
left-ring-distal,
left-little-proximal,
left-little-intermediate,
left-little-distal,
right-thumb-proximal,
right-thumb-intermediate,
right-thumb-distal,
right-index-proximal,
right-index-intermediate,
right-index-distal,
right-middle-proximal,
right-middle-intermediate,
right-middle-distal,
right-ring-proximal,
right-ring-intermediate,
right-ring-distal,
right-little-proximal,
right-little-intermediate,
right-little-distal,
}
variant attachment {
camera,
/// World-aligned agent position (tracks translation without rotating with
/// heading or head).
body,
bone(humanoid-bone),
}
/// Camera transform this frame in the calling script's document frame. Fails
/// with `not-ready` until the user's agent spawns (does not wait for avatar
/// loading).
camera-transform: func() -> result<transform, error>;
/// Bone transform this frame in the calling script's document frame, or
/// `none` if the avatar lacks that bone. Fails with `not-ready` until the
/// avatar finishes loading.
bone-transform: func(bone: humanoid-bone) -> result<option<transform>, error>;
/// Attaches a writable document at `offset` relative to the camera, body, or
/// a bone (local only). Detach by calling `wired:scene/document.place`.
/// Applies the same `offset` validation as `place`.
attach: func(document: borrow<document>, to: attachment, offset: transform) -> result<_, error>;
/// Desktop viewport dimensions and vertical FOV, or `none` in VR. Fails with
/// `forbidden` unless the local user authors the calling script's document.
viewport: func() -> result<option<screen>, error>;
/// Desktop viewport geometry.
record screen {
/// Width in pixels.
width: u32,
/// Height in pixels.
height: u32,
/// Vertical field of view in radians.
fov: f32,
}
}