ObjectTransform
public class ObjectTransform
Namespace: AR51.Unity.SDK
A plain, immutable data class describing a single object's pose. Construct one and hand it to ObjectTransformConsumer.OnObject; the consumer creates (if new) or updates a prefab GameObject keyed by Id, selecting the prefab by Type. All properties are get-only — there is no way to mutate a pose after construction.
Units
Position is in Unity world-space meters. Scale is a local scale (unitless multiplier). Use a Quaternion for Rotation, not Euler degrees.
Properties
All get-only.
| Property | Type | Description |
|---|---|---|
Id | string | object identifier — the key the consumer tracks GameObjects by |
Type | string | object type — selects which prefab the consumer instantiates |
Position | Vector3 | world-space position, in meters |
Rotation | Quaternion | world-space rotation |
Scale | Vector3 | local scale |
Constructors
public ObjectTransform(string id, string type, Vector3 position);
public ObjectTransform(string id, string type, Vector3 position, Quaternion rotation);
public ObjectTransform(string id, string type, Vector3 position, Quaternion rotation, Vector3 scale);
Three overloads, from minimal to full pose. Omitted arguments take Unity defaults:
| Constructor | Rotation | Scale |
|---|---|---|
(id, type, position) | Quaternion.identity | Vector3.one |
(id, type, position, rotation) | supplied | Vector3.one |
(id, type, position, rotation, scale) | supplied | supplied |
Exampleinferred
// Place an object 2 m forward, 1 m up — meters, Unity world space.
var pose = new ObjectTransform(
id: "crate-7",
type: "crate",
position: new Vector3(0f, 1f, 2f));
ObjectTransformConsumer.Instance.OnObject(pose);
See also
ObjectTransformConsumer— receives these poses viaOnObjectand maintains the matching prefab GameObjectsXRHeadsetTracker— feeds per-device poses into the consumer asObjectTransforms of type"XR"- Object detection — area overview
- Class index — all Unity SDK types
Was this page helpful?