Skip to main content

Anchor components

Two Blueprint-spawnable components that bind a scene transform to the AR 51 spatial anchor reported by UAnchorServiceComponent every frame. UCameraAnchorComponent pins attached content to the anchor by applying the inverse anchor transform; UWorldAnchorConstraintComponent makes the owning actor follow the first registered anchor. Use one or the other depending on whether you want content world-locked relative to the anchor, or an actor that tracks the anchor.

Units & space

Anchor transforms returned by UAnchorServiceComponent are in Unreal world space — centimeters and degrees. AR 51 mocap/CVS data is in meters; if you mix the two, convert with the service's AR51SDKToWorldSpace / WorldToAR51SDKSpace helpers first.

UCameraAnchorComponent

UCLASS · USceneComponent BlueprintSpawnableComponent
UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
class AR51SDK_API UCameraAnchorComponent : public USceneComponent

Inherits: USceneComponent (Unreal Engine)

Pins this scene component to the AR 51 spatial anchor so attached content stays world-locked. Every tick it sets its local-to-world transform to the inverse of the current anchor transform (UAnchorServiceComponent::GetAnchorTransform().Inverse()), re-expressing the camera/content relative to the anchor. Attach the content you want anchored as children of this component.

Properties

EditAnywhere, BlueprintReadWrite.

PropertyTypeDefaultDescription
General
EnsureHasAuthorityboolfalsewhen true, the per-tick anchor update is applied only if the owning actor has network authority (GetOwner()->HasAuthority()); when false, it always applies

Behavior

On each frame (TickComponent), the component reads the active anchor transform from UAnchorServiceComponent::GetAnchorTransform(), inverts it, and writes the result onto its own local-to-world transform. The constructor enables per-frame tick.

EnsureHasAuthority gates this update for networked/multiplayer scenes: leave it true so only the authoritative actor drives anchor placement and clients don't fight over it; leave it false (default) for single-player or client-local anchoring where every instance should apply the transform.

UWorldAnchorConstraintComponent

UCLASS · UActorComponent BlueprintSpawnableComponent
UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
class AR51SDK_API UWorldAnchorConstraintComponent : public UActorComponent

Inherits: UActorComponent (Unreal Engine)

Constrains the owning actor's scene transform to follow the first registered world anchor each frame. On BeginPlay it ensures the owner has a USceneComponent to drive. If no anchor service or no anchors exist, it logs and does nothing that frame.

Properties

EditAnywhere, BlueprintReadWrite.

PropertyTypeDefaultDescription
General
IsInverseboolfalseselects the transform direction applied every frame: false = the anchor's regular Local→World transform; true = the anchor's inverse World→Local transform

Behavior

On each frame (TickComponent), the component reads UAnchorServiceComponent::Instance()->GetAnchors(), takes anchors[0], and writes the chosen transform's location and rotation onto its own local transform. IsInverse picks regular vs. inverse direction. The constructor enables per-frame tick.

Always uses anchors[0]

UWorldAnchorConstraintComponent always follows the first anchor only — there is no API to select an anchor by id or index. If your scene has more than one anchor and you need to follow a specific one, this component is not the right tool; reach for UAnchorServiceComponent::GetAnchorById and drive the transform yourself.

See also

Was this page helpful?