USkeletonConsumer
UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
class AR51SDK_API USkeletonConsumer : public UActorComponent, public ISingleton<USkeletonConsumer>
Inherits: UActorComponent (Unreal Engine) · ISingleton<USkeletonConsumer>
The central entry point of the SDK. Drop one on an actor in the level; it connects to the AR 51 skeleton service, spawns/destroys a character per tracked person, drives each one every frame, and fires Blueprint events on person-lifecycle changes. Acts as a singleton.
This page is reference (facts only). For the step-by-step connect → drive a character walkthrough, see the How-to guide.
Properties
All EditAnywhere, BlueprintReadWrite.
| Property | Type | Default | Description |
|---|---|---|---|
| General | |||
ShowModel | bool | true | render the character mesh |
ShowSkeleton | bool | false | draw the skeleton gizmo |
ShowControllers | bool | false | draw controller meshes |
MaxSkeletonCount | int32 | 0 | cap on tracked skeletons (0 = unlimited) |
CharacterBlueprints | TArray<TSubclassOf<AActor>> | — | candidate AAR51CharacterActor BPs to spawn |
UpdateSkeleton | bool | true | apply incoming skeleton data each frame |
IsApplyHeadRotationWristPositionAndFingerRotations | bool | true | fuse device head rotation + wrist/finger poses |
SkeletonPredictionSettings | FPredictionSettings | — | smoothing / extrapolation model |
HandTrackingFallbackSmoothingFactor | float | 0.99 | smoothing when falling back to hand tracking |
SolverParameters | FSolverParams | — | IK / auto-scale settings |
| Visualization | |||
ControllerMesh | UStaticMesh* | — | mesh drawn for controllers |
ControllerSize | float | 0.1 | controller mesh scale |
SkeletonMesh | UStaticMesh* | — | mesh drawn per skeleton joint |
SkeletonSize | float | 0.025 | joint mesh scale |
| Debug | |||
bShowDebugBounds | bool | false | draw person bounds |
DebugBoxColor | FColor | Green | bounds box color |
DebugSphereColor | FColor | Red | bounds sphere color |
| Character instantiation | |||
ActivePersonCameraSpace | EActivePersonCameraSpace | ComponentSpace | space used to pick the active person |
MaxCameraDistanceThreshold | float | 20 | ⚠️ max distance (m?) for active-person selection |
DestroyInactivePersons | bool | true | destroy models for stale persons |
InactivePersonMaxSeconds | float | 1.0 | seconds without updates before removal |
HidePersonMaxSeconds | float | 0.2 | seconds without updates before hiding |
| Character mapping | |||
AutoCharacterAssignmentMode | EAutoCharacterAssignmentMode | Default | how characters are auto-assigned (Default / Cycle / Random) |
PersonIdToCharacterBPMap | TMap<FString,FString> | — | pin character BP by mocap PersonId |
EntityIdToCharacterBPMap | TMap<FString,FString> | — | pin by external EntityId |
EntityDisplayNameToCharacterBPMap | TMap<FString,FString> | — | pin by external display name |
| Recording | |||
IsRecording | bool | false | record incoming frames to InOutRecordingFile |
IsPlayback | bool | false | replay from InOutRecordingFile instead of the live stream |
IsPlaybackLoop | bool | false | loop playback |
InOutRecordingFile | FString | "/Recordings/file.txt" | record/playback file path |
Method summary
Static
| Method | Returns | |
|---|---|---|
GetSkeletonConsumerSingleton | USkeletonConsumer* | BlueprintCallable |
Instance
| Method | Returns | |
|---|---|---|
Connect | void | BlueprintCallable |
Disconnect | void | BlueprintCallable |
IsConnected | bool | BlueprintCallable |
GetEndpoint | FString | BlueprintCallable |
GetActivePerson | TScriptInterface<IPersonBase> | BlueprintCallable |
GetPersonByPersonId | TScriptInterface<IPersonBase> | BlueprintCallable |
GetPersonByEntityId / …DisplayName | TScriptInterface<IPersonBase> | BlueprintCallable |
GetPersonById | TMap<FString, …> | BlueprintCallable |
GetCharacters | TArray<UAR51Character*> | BlueprintCallable |
SetActiveCharacter | bool | BlueprintCallable |
FindCharacterIndexByName | int32 | BlueprintCallable |
SetCharacterBy… | void | BlueprintCallable · overloads |
ResetCharacter / …Characters | void | BlueprintCallable |
GetMainCameraComponent / SetMainCameraComponent | UCameraComponent* | BlueprintCallable |
GetLastCaptureTime | double | BlueprintCallable |
→ Full descriptions in Method details below.
Events
UPROPERTY(BlueprintAssignable), dynamic multicast. Bind in C++ with AddDynamic, or as a red event node in Blueprint.
| Event | Signature | Fires when |
|---|---|---|
OnPersonDetected | FOnPersonDetected(FString PersonId) | a person is detected for the first time (character spawned) |
OnPersonUpdated | FOnPersonUpdated(FString PersonId) | a person's skeleton data is updated (per-frame-ish) |
OnPersonTrackingLost | FOnPersonTrackingLost(FString PersonId) | tracking for a person is lost |
OnPersonTrackingRecovered | FOnPersonTrackingRecovered(FString PersonId) | tracking recovers after being lost |
OnPersonDestroyed | FOnPersonDestroyed(FString PersonId) | a person is destroyed (lost tracking too long) |
OnActivePersonChanged | FOnActivePersonChanged(FString PersonId) | the headset-associated active person changes — PersonId is "" when none |
A Person is created after MinSkeletonUpdateBeforeBirth updates (default 5) and removed after InactivePersonMaxSeconds (default 1) without updates.
Method details
GetSkeletonConsumerSingleton
static USkeletonConsumer* GetSkeletonConsumerSingleton();
The live consumer instance — the usual way to reach it from anywhere. (Deprecated alias: GetSingleton().)
nullptr if none is in the levelConnect
void Connect(const FString& endpoint);
Connects to the AR 51 skeleton service and starts the background consume loop; characters begin appearing as people are detected. Call once (e.g. on BeginPlay).
"IP:Port"void AMyManager::BeginPlay()
{
Super::BeginPlay();
auto* Consumer = USkeletonConsumer::GetSkeletonConsumerSingleton();
Consumer->OnPersonDetected.AddDynamic(this, &AMyManager::HandlePersonDetected);
Consumer->Connect(TEXT("127.0.0.1:50052")); // ⚠️ exact port depends on your OMS/skeleton service
}
Disconnect
void Disconnect();
Tears down the connection and stops consuming frames. Call on EndPlay.
IsConnected
bool IsConnected() const;
true while the stream is liveGetEndpoint
FString GetEndpoint() const;
"IP:Port"GetActivePerson
TScriptInterface<IPersonBase> GetActivePerson();
The person currently associated with the headset/camera (nearest/local) — the one you usually drive first-person logic or UI from.
if (UObject* P = Consumer->GetActivePerson().GetObject())
{
UAR51Character* Char = IPersonBase::Execute_GetCharacter(P);
const FVector Head = Char->GetHeadPosition(); // UE cm
}
GetPersonByPersonId
TScriptInterface<IPersonBase> GetPersonByPersonId(const FString& PersonId);
Look up a tracked person by the mocap system's per-person id.
if (UObject* P = Consumer->GetPersonByPersonId(PersonId).GetObject())
{
if (IPersonBase::Execute_IsTracked(P))
UE_LOG(LogTemp, Log, TEXT("Tracking %s"), *IPersonBase::Execute_GetId(P));
}
GetPersonByEntityId
TScriptInterface<IPersonBase> GetPersonByEntityId(const FString& EntityId);
TScriptInterface<IPersonBase> GetPersonByEntityDisplayName(const FString& Name);
Look up a person by the external-system entity id or display name (as opposed to the mocap PersonId).
GetPersonById
const TMap<FString, TScriptInterface<IPersonBase>>& GetPersonById();
GetCharacters
TArray<UAR51Character*> GetCharacters() const;
for (UAR51Character* Char : Consumer->GetCharacters())
{
const FVector L = Char->GetLeftWristPosition(); // UE cm
const FVector R = Char->GetRightWristPosition();
}
SetActiveCharacter
bool SetActiveCharacter(const FString& characterBPName);
Swap the active person's character to a named Blueprint from CharacterBlueprints.
CharacterBlueprintstrue if the swap succeeded// Swap the active person's mesh to a named character BP at runtime
if (!Consumer->SetActiveCharacter(TEXT("BP_RobotCharacter")))
UE_LOG(LogTemp, Warning, TEXT("Character BP not found in CharacterBlueprints"));
FindCharacterIndexByName
int32 FindCharacterIndexByName(const FString& CharacterBPName);
CharacterBlueprints, or -1 if not foundSetCharacterBy
void SetCharacterByPersonId(const FString& PersonId, const FString& CharacterBPName);
void SetCharacterIndexByPersonId(const FString& PersonId, int32 Index);
void SetCharacterByEntityId(const FString& EntityId, const FString& CharacterBPName);
void SetCharacterIndexByEntityId(const FString& EntityId, int32 Index);
void SetCharacterByEntityDisplayName(const FString& Name, const FString& CharacterBPName);
void SetCharacterIndexByEntityDisplayName(const FString& Name, int32 Index);
Pin a specific character Blueprint (by name or index) to a person, keyed by PersonId, EntityId, or display name. Use these for deterministic casting; otherwise rely on AutoCharacterAssignmentMode.
ResetCharacters
void ResetCharacter(const FString& PersonId); // remove that person + destroy its model
void ResetActiveCharacter(); // same, for the active person
void ResetCharacters(); // destroy all spawned models, clear tracking
Main camera
UCameraComponent* GetMainCameraComponent() const;
void SetMainCameraComponent(UCameraComponent*);
The camera used for head tracking / active-person selection. Override auto-detection with the setter when your rig has more than one camera.
GetLastCaptureTime
double GetLastCaptureTime() const;
See also
UAR51Character— the mocap-driven mesh this consumer spawns and drivesAAR51CharacterActor— the character actor listed inCharacterBlueprintsIPersonBase— the tracked-person interface returned by the lookups- Class index — all Unreal SDK types
- How-to: connect → drive a character