Skip to main content

IUserRepresentationHandler

Namespace: Holo.Core
Assembly: Holo.Core

Description

IUserRepresentationHandler defines the setup logic for a specific user representation.
Implement this interface to configure GameObjects, cameras, pipelines, audio, etc. when a user selects a representation type.

The handler receives a RepresentationSetupContext with all relevant information about the player and the environment.

Syntax

public interface IUserRepresentationHandler
{
void Setup(RepresentationSetupContext context);
}

Methods

Method Description

MethodDescription
Setup(RepresentationSetupContext context)Called to configure the player’s representation (enable object, bind pipelines, adjust cameras…).

Example: Simple Volumetric Representation

The SDK ships with a basic volumetric handler:

public class HoloCapturerRepresentationHandler : IUserRepresentationHandler {
public void Setup(RepresentationSetupContext ctx) {
try {
// Add your code to activate or init your pipeline or components.
// Like this example below for an holocapturer representation

ctx.PlayerManager.volum.SetActive(true);
if (!ctx.IsLocalPlayer) {
ctx.PlayerManager.volum.GetComponentInChildren<TrackedPoseDriver>().enabled = false;
}

UserRepresentationType representationType = UserRepresentationType.Get(ctx.Player.playerRepresentationType);

var pipeline = BasePipeline.AddPipelineComponent(ctx.PlayerManager.holoCapturer, representationType);
pipeline?.Init(ctx.Player, ctx.UserSourceType, ctx.IsPreview, ctx.IsProducer, ctx.IsConsumer);
}
catch (System.Exception ex) {
Debug.LogError($"Failed to setup HoloCapturer representation for player {ctx.Player.playerId}: {ex.Message}");
}
}
}

This enables the volum GameObject, disables the pose tracking driver for remote players and create and initialize a Pipeline.

See Also: