Skip to main content

Anchor Dynamics

Use the Interaction Kit Billboard and Headlock components to keep content on SPECS facing the user or in front of their head as they move.

  • Snapchat: not supported
  • SPECS: fully supported
  • Camera Kit Web: not supported
  • Camera Kit Mobile: not supported
  • SnapchatNot supported
  • SPECSFully supported
  • Camera Kit WebNot supported
  • Camera Kit MobileNot supported

Platform details

  • Snapchat — Not supported.

  • SPECS — Fully supported.

  • Camera Kit Web — Not supported.

  • Camera Kit Mobile — Not supported.

Interaction Kit provides components that anchor objects relative to the user as they move. The Billboard component keeps a scene object facing the user by updating its rotation toward the camera every frame. The Headlock component keeps a scene object in the user's field of view by moving it with the user's head.

Billboard: keep an object facing the user

Billboard rotates a scene object to face the camera. Choose the axes it rotates around:

InputDefaultWhat it does
X Axis EnabledOffPitch: the object tilts up and down to face the camera.
Y Axis EnabledOnYaw: the object turns left and right to follow the camera.
Z Axis EnabledOffRoll: the object rolls to match the camera's up direction.
Axis Buffer Degrees0, 0, 0For each axis, how many degrees the object can be off before it rotates. Larger values make it steadier.
Axis Easing1, 1, 1For each axis, how fast the object follows: 1 is instant, lower values follow more smoothly.

In scripts, the axes are xAxisEnabled, yAxisEnabled, and zAxisEnabled.

Headlock: keep an object in front of the user's head

Headlock positions a scene object relative to the user's head. Its inputs set the Distance from the head and how the object follows: position (XZ Enabled, Y Enabled, their easing, and Translation Buffer) and rotation (Locked Pitch, Locked Yaw, with their easing, offsets, and buffers). Lag on position and rotation balances a head-locked object, which moves with the head, against a world-locked one, which stays in place.

Turn billboarding on and off from a script

This script turns billboarding around the Y axis on and off each time the user selects the object. It assumes the scene object already has a Billboard, an Interactable, and a collider. For a themed toggle control instead of a plain Interactable, use UI Kit.

import { Billboard } from 'InteractionKit.lspkg/Components/Interaction/Billboard/Billboard';
import { Interactable } from 'InteractionKit.lspkg/Components/Interaction/Interactable/Interactable';

@component
export class ExampleAnchorDynamicsScript extends BaseScriptComponent {
onAwake() {
this.createEvent('OnStartEvent').bind(() => {
this.onStart();
});
}

onStart() {
const billboard = this.sceneObject.getComponent(
Billboard.getTypeName()
) as Billboard;
const interactable = this.sceneObject.getComponent(
Interactable.getTypeName()
) as Interactable;

// Disable billboarding initially.
billboard.xAxisEnabled = false;
billboard.yAxisEnabled = false;
billboard.zAxisEnabled = false;

// Each time the user selects the object, switch billboarding along the y-axis.
interactable.onTriggerEnd.add(() => {
billboard.yAxisEnabled = !billboard.yAxisEnabled;
});
}
}
  • Interaction System: the Interactable events used in the script.
  • Components List: every Interaction Kit component with its module path.
  • UI Kit: panels and controls for SPECS built on Interaction Kit.