Skip to main content

Scene components & anchors

scene components Unity component

A cluster of small MonoBehaviours you drop on scene GameObjects to visualize spatial anchors and the play-area boundary, constrain a transform, billboard toward the camera, or feed Inspector-assigned hand transforms into the SDK as an adapter.

Units

This is a Unity SDK page — all positions, lengths, and heights are in Unity world-space meters; rotations are Quaternion; angles are in degrees.

Five components live here:

ComponentNamespaceRole
AnchorVisualizationAR51.Unity.SDKsave/disable UI control for a visual spatial anchor
BoundaryVisualizationAR51.Unity.SDKbuilds a wall mesh + outline for a recorded play-area boundary
ConstrainPositionAR51.Unity.SDK.Componentscopies a source transform's position each frame
CustomHandsAdapterAR51.Unity.SDK.Componentsin-scene IHandsAdapter driven by Inspector transforms
FaceCameraAR51.Unity.SDK.Componentsyaw-billboards this GameObject toward the camera

AnchorVisualization

class · MonoBehaviour Unity component
public class AnchorVisualization : MonoBehaviour

Namespace: AR51.Unity.SDK

A localized UI/control entry for an AR 51 visual spatial anchor. Attach it to a GameObject; it exposes save/disable requests both as code events and as an Inspector-wireable UnityEvent, so anchor UI (buttons, gestures) can drive persistence without your script knowing the anchor internals.

Events

EventTypeFires when
OnSaveRequestEventHandlerRequestSave() is called
OnDisableRequestUnityEventRequestDisable() is called — wire it in the Inspector

Method summary

MethodReturns
RequestSavevoidUnity component
RequestDisablevoidUnity component
CallOnSaveRequestAnchorVisualizationfluent

RequestSave

methodUnity component
public void RequestSave();

Raises OnSaveRequest. Call from your save button/gesture to ask whatever subscribed (e.g. anchor-persistence logic) to save this anchor.

RequestDisable

methodUnity component
public void RequestDisable();

Invokes the OnDisableRequest UnityEvent. Use it to tear down or hide the anchor visualization; wire the response in the Inspector.

CallOnSaveRequest

methodfluent
public AnchorVisualization CallOnSaveRequest(EventHandler handler);

Subscribes handler to OnSaveRequest and returns this instance, so you can chain configuration fluently.

Parameters
handlerEventHandlercallback invoked on each save request
ReturnsAnchorVisualizationthis instance, for chaining
Exampleinferred
// Subscribe fluently, then keep configuring on the same line.
anchorViz
.CallOnSaveRequest((s, e) => Debug.Log("Anchor save requested"));

BoundaryVisualization

class · MonoBehaviour Unity component RequireComponent
public class BoundaryVisualization : MonoBehaviour

Namespace: AR51.Unity.SDK

Builds a wall mesh plus an outline for a recorded play-area boundary. Requires a MeshFilter + MeshRenderer on the same GameObject and expects a child LineRenderer for the outline. Set the fields before Start — the mesh is built at startup from Points and Height. If Id matches the active boundary's name the wall renders red; otherwise an auto-color is chosen. Feed it from a boundary source such as IBoundaryAdapter.GetPoints().

Properties

PropertyTypeDescription
Idstringboundary identifier — matches the active boundary's name → renders red, else auto-color
PointsVector3[]ordered ground-plane outline points. ⚠️ world-space, meters. Fewer than 4 points skips the mesh
Heightfloatwall height in meters, extruded along +Y
Visibleboolget/set — toggles wall + outline rendering
Exampleinferred
// Visualize the platform boundary reported by the active boundary adapter.
var viz = boundaryGO.GetComponent<BoundaryVisualization>();
viz.Id = BoundaryAdapterFactory.GetAdapter().BoundaryName;
viz.Points = BoundaryAdapterFactory.GetAdapter().GetPoints(); // world-space meters
viz.Height = 2.5f; // meters
// Set before Start; the wall mesh is built at startup.

ConstrainPosition

class · MonoBehaviour Unity component
public class ConstrainPosition : MonoBehaviour

Namespace: AR51.Unity.SDK.Components

A position-only follow constraint. Each Update it copies Source's world position onto this GameObject (rotation and scale are left untouched). A null Source is a no-op.

Properties

PropertyTypeDescription
SourceTransformthe transform to follow each frame; null = no-op
Exampleinferred
// Pin a label to a tracked joint's world position without inheriting its rotation.
labelGO.GetComponent<ConstrainPosition>().Source = headBoneTransform;

CustomHandsAdapter

class · MonoBehaviour Unity component IHandsAdapter
public class CustomHandsAdapter : MonoBehaviour, IHandsAdapter

Namespace: AR51.Unity.SDK.Components

An in-scene IHandsAdapter driven by Inspector-assigned Transforms instead of a device tracker. It samples the mapped transforms each request and reports them as HandJointInfo with Confidence = 1.0, and can keep the wrist anchored to a tracked source. Joint arrays are assembled on Awake. Use it to puppet hands from authored/animated transforms, or as a stand-in when no hardware hand tracking is present.

tip

This is the scene-component counterpart to the registry-based adapters. For the adapter interface, the factory, and how the SDK resolves an active adapter per platform, see Hands, controllers & boundary adapters.

Properties

PropertyTypeDescription
SourceDevicestringget-only — always "CustomHandModel"
WristTrackingModeWristTrackingModeTypehow the wrist is driven: None / TrackActivePerson / TrackDeviceAdapter
LeftHandHandMappingInspector bone-transform mapping for the left hand
RightHandHandMappingInspector bone-transform mapping for the right hand

Method summary

MethodReturns
GetRightJointInfos / GetLeftJointInfosHandJointInfo[]IHandsAdapter
GetJointsTransform[]Unity component
GetHandHandMappingUnity component

GetRightJointInfos / GetLeftJointInfos

methodIHandsAdapter
public HandJointInfo[] GetRightJointInfos();
public HandJointInfo[] GetLeftJointInfos();

The IHandsAdapter snapshot methods. Each joint is sampled from the assigned transforms with Confidence = 1.0; order follows the HandJointType enum (index = (int)HandJointType).

ReturnsHandJointInfo[]the hand's joints, index-ordered, each at full confidence

GetJoints

methodUnity component
public Transform[] GetJoints(HandType type);

The assembled joint transforms for a hand (wrist + fingers, SDK order).

Parameters
typeHandTypewhich hand (left/right) — see HandType
ReturnsTransform[]the wrist + finger transforms in SDK joint order

GetHand

methodUnity component
public HandMapping GetHand(HandType type);

Returns the HandMapping for the given hand.

Nested types

[Serializable] HandMapping holds the per-hand transform mapping (Type, Source, Wrist, and the per-finger groups). Each finger group — ThumbJoints, IndexJoints, MiddleJoints, RingJoints, PinkyJoints — is a serializable struct of Transform fields with a Transform[] ToArray() returning them base→tip. Assign these in the Inspector.

FaceCamera

class · MonoBehaviour Unity component
public class FaceCamera : MonoBehaviour

Namespace: AR51.Unity.SDK.Components

A yaw-only billboard. Each frame it rotates this GameObject about the Y axis to face the camera; pitch is ignored, so upright labels and panels stay level. Falls back to Camera.main when Camera is unset; a null camera is a no-op.

Properties

PropertyTypeDescription
CameraCameratarget camera; falls back to Camera.main, null = no-op
Exampleinferred
// Keep a world-space name tag turned toward the player's view, staying upright.
tagGO.AddComponent<FaceCamera>(); // uses Camera.main by default

See also

Was this page helpful?