Web SDK: SonaCamera¶
The scene's camera, scene.camera: the console's framings, an orbit, a free camera, eased moves and pointer controls.
SonaCamera properties¶
| Field | Type | Meaning |
|---|---|---|
fov |
number |
Vertical field of view in degrees. Default 28.65 (0.5 rad, the console's). |
near |
number |
Near plane in metres. Default 0.05. |
far |
number |
Far plane in metres. Default 200. |
eye |
Vec3 |
Where the camera is. Read only. |
target |
Vec3 |
What it looks at. Read only. |
camera.preset()¶
interface SonaCamera {
preset(name: PresetName, on?: SonaAvatar, opts?: { over?: number }): void;
}
One of the console's framings on one avatar, or "crowd" to fit every avatar.
| Parameter | Type | Meaning |
|---|---|---|
name |
PresetName |
A framing: "full", "upper", "bust" or "face", or "crowd" to fit every avatar. |
on (optional) |
SonaAvatar |
The avatar to frame. Default: the first ready one. "crowd" frames them all. |
opts.over (optional) |
number |
Seconds to ease there. Default 0 (at once). |
import { SonaRenderer } from './sona-renderer.js';
const canvas = document.querySelector('canvas');
const sona = await SonaRenderer.create({ canvas });
const avatar = sona.add(manifestBase64, { clip: 'GenericStand5' });
await avatar.ready;
// 'full', 'upper', 'bust' or 'face'
sona.camera.preset('bust', avatar, { over: 0.5 });

camera.orbit()¶
interface SonaCamera {
orbit(
o: { yaw?: number; pitch?: number; distance?: number; target?: Vec3 },
opts?: { over?: number },
): void;
}
Orbit around a target. yaw and pitch in degrees, distance in metres.
| Parameter | Type | Meaning |
|---|---|---|
o.yaw (optional) |
number |
Degrees round the target. Default: as now. |
o.pitch (optional) |
number |
Degrees up, -89 to 89. Default: as now. |
o.distance (optional) |
number |
Metres from the target. Default: as now. |
o.target (optional) |
Vec3 |
The point to orbit, in metres. Default: as now. |
opts.over (optional) |
number |
Seconds to ease there. Default 0 (at once). |
import { SonaRenderer } from './sona-renderer.js';
const canvas = document.querySelector('canvas');
const sona = await SonaRenderer.create({ canvas });
const avatar = sona.add(manifestBase64, { clip: 'GenericStand5' });
await avatar.ready;
sona.camera.orbit({
yaw: 35, pitch: 10, distance: 4.4, target: [0, 0.9, 0],
});

camera.lookAt()¶
interface SonaCamera {
lookAt(eye: Vec3, target: Vec3, opts?: { over?: number }): void;
}
A free camera.
| Parameter | Type | Meaning |
|---|---|---|
eye |
Vec3 |
Where the camera goes, in metres. |
target |
Vec3 |
The point it looks at, in metres. |
opts.over (optional) |
number |
Seconds to ease there. Default 0 (at once). |
camera.controls()¶
interface SonaCamera {
controls(
on: boolean | { drag?: boolean; zoom?: boolean; pitch?: boolean },
): void;
}
Pointer controls on the canvas.
| Parameter | Type | Meaning |
|---|---|---|
on |
boolean | { drag?: boolean; zoom?: boolean; pitch?: boolean } |
true: drag turns and the wheel zooms. false: none. Or each one: drag turns, zoom scrolls, pitch tilts with an up and down drag. |
import { SonaRenderer } from './sona-renderer.js';
const canvas = document.querySelector('canvas');
const sona = await SonaRenderer.create({ canvas });
sona.add(manifestBase64);
sona.camera.controls({ drag: true, zoom: true });
PresetName¶
type PresetName = 'full' | 'upper' | 'bust' | 'face' | 'crowd';
The console's framings, and "crowd" to fit every avatar.
This page as Markdown · All the docs as one file (llms-full.txt)