Revolves a node around a pivot at a fixed radius by azimuth and elevation — the way to put an object (or a camera) on a controllable orbit.
Declarative element:
<sk-orbit-constraint>
Not on the sk.* global — construct via the declarative element or a module import.
This is the orbiting member of the Constraint family: like every constraint
it drives its constrained target by recomputing from live scene state each frame —
here it places the target on a sphere around a pivot from spherical angles, so
animating one angle sweeps a smooth revolution. The orbit parameters live on the
constraint itself, or come from a separate Orbit node so several targets
share one orbit definition (and its sk-orbit visualization).
Key attributes. radius is the orbit distance from the pivot. azimuth sweeps
around the vertical axis and elevation tilts above/below the horizontal plane;
both are angles and both are animatable, so sweeping azimuth through a full turn
produces a continuous orbit. orient-toward-pivot additionally turns the target to
face the pivot. Two further options refine it: orientation-axis chooses which
local axis points inward when orienting (default -z), and min-radius clamps how
close the orbit may pull in.
Related. Pairs with the sk-orbit support node (which holds shared
orbit parameters and can draw the ring) and its class Orbit. Sibling
constraints in the Constraint family include
sk-align-to-spline-constraint (follow an arbitrary path) and
sk-target-at-constraint (aim at a node); the GPU-parallel
PointConstraint applies per-clone effects across a Cloner.
constructor(config?: { source: Orbit | SceneNode; radius?: number; azimuth?: number; elevation?: number; orientTowardPivot?: boolean; orientationAxis?: AxisOrientation; id?: string })
Inherited from: Constraint, SkenraAnimatable
— see those pages for inherited members.
| Property | Type | Default | Description | Declared by |
|---|---|---|---|---|
sourceconfig-only |
Orbit | SceneNode |
— | The orbit source: an Orbit, or a SceneNode used as |
OrbitConstraintConfig |
radius |
number |
0 |
Orbit radius — distance from the pivot. | OrbitConstraint |
azimuth |
number |
0 |
Azimuth angle (radians) around the pivot’s vertical axis. | OrbitConstraint |
elevation |
number |
0 |
Elevation angle (radians) above the pivot’s horizontal plane. | OrbitConstraint |
orientTowardPivot |
boolean |
false |
When true, the orbiting node faces the pivot. | OrbitConstraint |
orientationAxis |
AxisOrientation |
"-z" |
Which local axis points toward the pivot when orienting. | OrbitConstraint |
idconfig-only |
string |
— | Optional unique identifier for the constraint. | OrbitConstraintConfig |
| Property | Type | Default | Description | Declared by |
|---|---|---|---|---|
orbitNoderead-only |
Orbit |
— | The Orbit helper whose pose this constraint applies to its target. | OrbitConstraint |
minRadius |
number | undefined |
— | Minimum orbit radius the controller will zoom to. | OrbitConstraint |
pivot |
string | undefined |
— | Pivot the node orbits around — an element id reference (#id) of a node to track. |
OrbitConstraint |
targetread-only |
SkenraAnimatable | null |
— | The node this constraint modifies. | Constraint |
priority |
number |
— | Gets the priority for this modifier in the effect stack. | Constraint |
sceneread-only |
any |
— | Gets the Scene this animatable belongs to, if any. | SkenraAnimatable |
animationsread-only |
SkenraAnimation[] |
— | Public getter for the animations affecting this target. | SkenraAnimatable |
| Method | Description | Declared by |
|---|---|---|
animate(firstArg: any, secondArg?: any): SkenraAnimation & Animation |
Animations declared as children of <sk-orbit-constraint> target |
OrbitConstraint |
removeAnimation(animation: SkenraAnimation): boolean |
Removes a specific animation from this object. | SkenraAnimatable |
constrain(type: K, config: ConstraintConfigMap[K]): ConstraintReturnMap[K] |
Creates a constraint on this Animatable using a fluent API. | SkenraAnimatable |
// Put a camera on an orbit node so several targets can share it.
const orbitNode = new Orbit({ id: 'orbit', radius: 15,
azimuth: Math.PI / 4, elevation: Math.PI / 6, orientTowardPivot: true });
scene.appendChild(orbitNode);
camera.constrain('orbit', { source: orbitNode });
Used in guides: Scene basics