Skip to main content

UAnchorServiceComponent

UCLASS · UActorComponent BlueprintSpawnableComponent singleton
UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
class AR51SDK_API UAnchorServiceComponent : public UActorComponent, public ISingleton<UAnchorServiceComponent>

Inherits: UActorComponent (Unreal Engine) · ISingleton<UAnchorServiceComponent>

Hosts the spatial-anchor / guardian-boundary service. Drop one on the SDK actor to get world-locked anchors and guardian boundaries: it manages the spawned anchor actors and boundary geometry in the level, fires Blueprint events on anchor lifecycle, and can compensate anchor transforms when device tracking is lost. Acts as a singleton.

Anchor and boundary creation, deletion, visibility, and guardian management are driven remotely over the service (server-side handlers), not by Blueprint calls. The caller-facing surface is: bind the events, read the anchors/transform, and convert coordinates.

Units & space

Unreal world units are centimeters and rotations are degrees; AR 51 mocap/CVS data is in meters (and a different coordinate convention). Anchor transforms returned here are in UE world space (cm/deg). Any position/rotation crossing the AR 51 ↔ Unreal boundary must be converted — use the coordinate-conversion helpers.

Properties

All EditAnywhere, BlueprintReadWrite.

PropertyTypeDefaultDescription
General
IsAutoSyncCameraToAnchorbooltruekeep the camera aligned to the active anchor automatically
AnchorBPTSubclassOf<AActor>Blueprint spawned to visualize each anchor
BoundaryBPTSubclassOf<AActor>Blueprint used for boundary geometry
BoundaryMaterialTSubclassOf<UMaterial>material applied to boundary meshes
BoundaryHeightfloat100extruded boundary wall height — cm ⚠️ unit inferred
Tracking-lost compensation
IsTrackingLostCompensateboolfalseenable tracking-loss compensation
TrackingLostCompensateThresholdfloat50distance jump that triggers compensation — ⚠️ likely cm
TrackingLostZeroPositionsCooldownTimeoutfloat0.2seconds
TrackingLostDeltaTimeThresholdfloat~0.032seconds (2×16 ms)
TrackingLostMaxXYDegreesCompensatefloat5clamp on rotational compensation — degrees
Debug
IsPrintAnchorLocationbooltruelog anchor world locations

Method summary

Static

MethodReturns
GetAnchorServiceSingletonUAnchorServiceComponent*BlueprintCallable
GetAnchorTransformFTransformBlueprintCallable
AR51SDKToWorldSpace / WorldToAR51SDKSpacevoidBlueprintCallable · overloads

Instance

MethodReturns
GetAnchorsTArray<AActor*>C++ only
GetAnchorByIdAActor*C++ only

Events

UPROPERTY(BlueprintAssignable), dynamic multicast. Bind in C++ with AddDynamic, or as a red event node in Blueprint.

EventSignatureFires when
OnAnchorCreatedFOnAnchorCreated(FString AnchorId)an anchor is created
OnAnchorDestroyedFOnAnchorDestroyed(FString AnchorId)an anchor is destroyed
OnTrackingLostCompensatedFTrackingLostCompensationEvent()the SDK detects tracking loss and re-aligns the anchor — a good hook for UI/logging

Method details

GetAnchorServiceSingleton

methodstaticBlueprintCallable
static UAnchorServiceComponent* GetAnchorServiceSingleton();

The live anchor-service instance — the usual way to reach it from anywhere.

ReturnsUAnchorServiceComponent*the singleton, or nullptr if none is in the level
Exampleinferred
void AMyAnchorManager::BeginPlay()
{
Super::BeginPlay();
if (auto* Anchors = UAnchorServiceComponent::GetAnchorServiceSingleton())
{
Anchors->OnAnchorCreated.AddDynamic(this, &AMyAnchorManager::HandleAnchorCreated);
Anchors->OnAnchorDestroyed.AddDynamic(this, &AMyAnchorManager::HandleAnchorDestroyed);
}
}

GetAnchors

methodC++ only
const TArray<AActor*> GetAnchors() const;

All live anchor actors currently spawned in the level. Not a UFUNCTION — C++ only.

ReturnsTArray<AActor*>every spawned anchor actor

GetAnchorById

methodC++ only
AActor* GetAnchorById(const FString& id) const; // also a const std::string& overload

Look up a spawned anchor actor by its id. Not a UFUNCTION — C++ only.

Parameters
idFStringthe anchor id (as delivered by OnAnchorCreated)
ReturnsAActor*the anchor actor, or nullptr if no anchor with that id exists
Exampleinferred
void AMyAnchorManager::HandleAnchorCreated(FString AnchorId)
{
auto* Anchors = UAnchorServiceComponent::GetAnchorServiceSingleton();
if (AActor* Anchor = Anchors->GetAnchorById(AnchorId))
SpawnContentAt(Anchor->GetActorTransform()); // UE world space, cm/deg
}

GetAnchorTransform

methodstaticBlueprintCallable
static FTransform GetAnchorTransform();

The current active-anchor transform, in Unreal world space (cm / degrees). Use it to position content relative to the anchor.

ReturnsFTransformthe active anchor's world transform — UE world space, cm/deg

AR51SDKToWorldSpace / WorldToAR51SDKSpace

methodstaticBlueprintCallableoverloads
// AR 51 (meters) → Unreal world (cm), in place
static void AR51SDKToWorldSpace(FVector& position);
static void AR51SDKToWorldInplace(TArray<FVector>& positions);
static void AR51SDKToWorldSpace(FQuat& rotation);

// Unreal world (cm) → AR 51 (meters), in place
static void WorldToAR51SDKSpace(FVector& position);
static void WorldToAR51SDKSpace(TArray<FVector>& positions);
static void WorldToAR51SDKSpace(FQuat& rotation);
static void WorldToAR51SDKSpace(TArray<FQuat>& rotations);

The bridge between AR 51 space (meters) and Unreal world space (cm) — these convert position and rotation in place (the argument is modified). AR 51 uses both a different unit (meters vs cm) and a different coordinate convention, so a raw value cannot be used across the boundary unconverted. Call AR51SDKToWorldSpace on anything coming from the AR 51 system before using it in the level; call WorldToAR51SDKSpace on anything you send to the AR 51 system.

Parameters
positionFVectora position to convert in place — read as cm after AR51SDKToWorldSpace, as meters after WorldToAR51SDKSpace
rotationFQuata rotation to convert in place (coordinate convention is remapped, not just scaled)
Exampleinferred
// A point reported by the AR 51 system, in meters → use it in the UE level (cm)
FVector P = AnchorPointFromAR51(); // AR 51 space, meters
UAnchorServiceComponent::AR51SDKToWorldSpace(P); // now UE world space, cm
MyActor->SetActorLocation(P);

// Send a UE world-space position back to the AR 51 system
FVector Q = MyActor->GetActorLocation(); // UE world space, cm
UAnchorServiceComponent::WorldToAR51SDKSpace(Q); // now AR 51 space, meters

See also

Was this page helpful?