Skip to main content

UObjectDetectionConsumer

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

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

Drop one on an actor in the level. On BeginPlay it registers with the AR 51 SDK, auto-connects when the CVS component appears on the network, and from then on spawns, updates, and prunes a child actor for every detected marker (a colored ball/disc tracker) and object (a full 6-DoF tracked prop). The owning actor's transform is the parent/anchor space for everything it spawns.

You configure it in the editor (meshes, materials, prefabs, smoothing, pruning) and then read live state by polling — there are no detection events. Acts as a C++ singleton.

Units

The AR 51 system reports positions in meters; this component converts them to Unreal centimeters internally before placing spawned actors, so all spawned actor transforms are in UE world units (cm). A few fields are not converted and stay in AR 51 meters — notably UTrackedInstance::Radius and the smoothing thresholds below; each is flagged inline.

How-to

This page is reference (facts only). For the step-by-step drop the component → read tracked markers/objects walkthrough, see the How-to guide.

Properties

All EditAnywhere, BlueprintReadWrite, grouped by editor category.

PropertyTypeDefaultDescription
General
MarkerMaterialUMaterialInterface*base material for marker spheres; a dynamic instance is created per marker and tinted from ColorName (sets vector param "Color"). Logs an error at BeginPlay if null
MarkerMeshUStaticMesh*mesh used for the sphere spawned per marker. Logs an error at BeginPlay if null
MarkerScalefloat1.0multiplier on marker size; final scale = MarkerScale * radius (uniform)
DefaultObjectMeshUStaticMesh*fallback mesh for a detected object when no matching prefab is found in Prefabs (spawned as a small cube, ~0.2 relative scale)
ShowMarkersbooltruetoggles visibility of all marker actors
PrefabsTArray<TSubclassOf<AActor>>candidate Blueprints for 6-DoF objects; matched by the object's name (or name + "_C") against the class name
SmoothRotationfloat0lerp factor for the rolling-ball rotation applied to the owner actor each tick (0 = none). ⚠️ unusual owner-rotation behavior — see Lifecycle
Inactives
DestroyInactivesbooltruemaster switch for the hide/destroy pruning pass each tick
HideMarkerMaxSecondsfloat0.02seconds without an update before an instance's actor is hidden. ⚠️ very small (~1 frame at 50 fps) — markers flicker hidden between updates by design
InactivesMaxSecondsfloat2.0seconds without an update before an instance's actor (and any AttachedItem) is destroyed and removed from tracking
MarkerItems
MarkerItemsTArray<FMarkerItem>rules for spawning extra visuals on markers by type (see FMarkerItem)
ShowMarkerItemsbooltruetoggles visibility of the spawned AttachedItem actors
Smoothing (object 6-DoF only)
SmoothPositionalFactorfloat0.2lerp blend when an object's position delta is small; higher = stickier/slower
SmoothPositionalThresholdfloat0.03if the new position is within this distance of the current, smooth (lerp); otherwise snap. ⚠️ Units: compared against a UE-space delta (cm), but 0.03 looks like a meters threshold — unclear/unverified
SmoothRotationFactorfloat0.2lerp blend for yaw when within threshold
SmoothRotationAngleThresholdfloat12.0degrees; if yaw change is below this, smooth-rotate, otherwise snap to the new orientation

Method summary

All query methods below are C++ only — they are not marked UFUNCTION, so they are not callable from Blueprint as written.

Instance

MethodReturns
IsConnectedboolC++ only
GetTrackedMarkersTArray<UTrackedInstance*>C++ only
GetTrackedObjectsTArray<UTrackedInstance*>C++ only
⚠️ unverified — Blueprint access

IsConnected, GetTrackedMarkers, and GetTrackedObjects are the natural query API but are not UFUNCTION(BlueprintCallable), so today they are reachable only from C++. If Blueprint access is intended, they would need the UFUNCTION markup added.

→ Full descriptions in Method details below. Connection itself is handled automatically (see Lifecycle); there is no public Connect/Disconnect.

Events

None. This consumer is poll-only — there are no BlueprintAssignable delegates or dynamic-multicast events for "object detected / updated / removed." Detection runs entirely inside a private callback that spawns, updates, and (via the prune pass) destroys actors directly. Observe state by polling GetTrackedMarkers / GetTrackedObjects, or by watching the spawned child actors.

⚠️ unverified — no notification surface

If game code needs "on detected / updated / removed" callbacks, that surface does not currently exist and would have to be added (e.g. BlueprintAssignable FObjectDetected / FObjectUpdated / FObjectRemoved delegates).

Method details

IsConnected

methodC++ only
bool IsConnected();

true while the component is connected to a CVS endpoint.

Returnsboolwhether the live feed is connected

GetTrackedMarkers

methodC++ only
TArray<UTrackedInstance*> GetTrackedMarkers() const;

Snapshot of all currently-tracked instances of type Marker (point/sphere trackers — id + color + radius, position only).

ReturnsTArray<UTrackedInstance*>the tracked markers this frame
Exampleinferred
auto* OD = UObjectDetectionConsumer::GetSingleton();
if (OD && OD->IsConnected())
{
for (UTrackedInstance* M : OD->GetTrackedMarkers()) // C++ only
{
const FVector Loc = M->GetOwner()->GetActorLocation(); // UE cm
UE_LOG(LogTemp, Log, TEXT("%s %s @ %s"), *M->ColorName, *M->Id, *Loc.ToString());
}
}

GetTrackedObjects

methodC++ only
TArray<UTrackedInstance*> GetTrackedObjects() const;

Snapshot of all currently-tracked instances of type Object (full 6-DoF props matched to a Prefabs Blueprint).

ReturnsTArray<UTrackedInstance*>the tracked objects this frame

Lifecycle

This consumer manages its own connection and spawning — you configure it and read it, you do not drive it.

  • BeginPlay registers with the AR 51 SDK registration service and subscribes to component add/remove. It auto-connects when a CVS endpoint appears on the network and auto-disconnects when it is removed. Logs errors if MarkerMesh or MarkerMaterial are unset.
  • On each detection frame, markers spawn a sphere (MarkerMesh, tinted from ColorName) parented under the owner; objects spawn the matching Prefabs entry or a DefaultObjectMesh cube. Existing instances (keyed by Id) are updated in place — position is unit-converted to cm; objects also get smoothed yaw/position per the Smoothing properties.
  • TickComponent runs the prune pass (hide after HideMarkerMaxSeconds, destroy after InactivesMaxSeconds, gated by DestroyInactives) and additionally applies a "rolling ball" world-rotation to the owner actor based on how far it moved this frame.
⚠️ unverified — owner rolling-rotation

The per-tick rolling-ball rotation applied to the owner actor (driven by SmoothRotation) is unusual for a tracking consumer. Confirm whether it is intended public behavior or a leftover before relying on it.

FMarkerItem

USTRUCT(BlueprintType)
USTRUCT(BlueprintType)
struct FMarkerItem

An editor-configured rule: "when a marker of this type is detected, also spawn this Blueprint as a visual." Populate the consumer's MarkerItems array with these. On a match, the spawned actor is parented to the marker and stored as its UTrackedInstance::AttachedItem; it is destroyed with the marker.

FieldTypeDefaultDescription
MarkerTypeFStringsubstring matched (case-sensitive Contains) against a marker's ColorName; a match triggers spawning Blueprint
BlueprintTSubclassOf<AActor>actor class spawned and parented to the matched marker; stored as the marker's AttachedItem
bEnabledbooltrueif false, this rule is skipped

All fields are EditAnywhere, BlueprintReadWrite.

See also

Was this page helpful?