Skip to content

Getting Started

Alpha notice: this SDK API is prone to change while the public surface stabilizes.

ViziverseAI exposes a small Unity API for person tracking. The public API is limited to the ViziverseAI namespace:

  • ViziverseVision
  • Person
  • BodyPoint

Basic Setup

Add the ViziverseAI runtime prefab to your scene, then call ViziverseVision.Initialize() from your own Unity component.

csharp
using UnityEngine;
using ViziverseAI;

public sealed class PersonTrackingBootstrap : MonoBehaviour
{
    private void OnEnable()
    {
        ViziverseVision.Initialize();
    }

    private void OnDisable()
    {
        ViziverseVision.Shutdown();
    }
}

Call SDK methods and read SDK data from the Unity main thread.

Subscribe To Person Events

Use events when your game or app should react as people enter, move, or leave.

csharp
using UnityEngine;
using ViziverseAI;

public sealed class PersonEventsExample : MonoBehaviour
{
    private void OnEnable()
    {
        ViziverseVision.Initialize();
        ViziverseVision.OnPersonEntered += OnPersonEntered;
        ViziverseVision.OnPersonMoved += OnPersonMoved;
        ViziverseVision.OnPersonLeft += OnPersonLeft;
    }

    private void OnDisable()
    {
        ViziverseVision.OnPersonEntered -= OnPersonEntered;
        ViziverseVision.OnPersonMoved -= OnPersonMoved;
        ViziverseVision.OnPersonLeft -= OnPersonLeft;
        ViziverseVision.Shutdown();
    }

    private static void OnPersonEntered(Person person)
    {
        Debug.Log($"Person {person.Id} entered.");
    }

    private static void OnPersonMoved(Person person)
    {
        if (!person.IsPointVisible(BodyPoint.RightWrist))
            return;

        Vector2 point = person.GetPoint(BodyPoint.RightWrist);
        Debug.Log($"Right wrist image point: {point}");
    }

    private static void OnPersonLeft(Person person)
    {
        Debug.Log($"Person {person.Id} left.");
    }
}

Poll Current People

Use polling when you need a snapshot of all currently tracked people.

csharp
using UnityEngine;
using ViziverseAI;

public sealed class PeoplePollingExample : MonoBehaviour
{
    private void Update()
    {
        for (var i = 0; i < ViziverseVision.PeopleCount; i++)
        {
            Person? person = ViziverseVision.GetPerson(i);
            if (person == null)
                continue;

            Debug.Log($"Person {person.Id}: confidence {person.Confidence}");
        }
    }
}

Coordinate Note

Person.GetPoint() returns image-space coordinates.

Person.GetPoint3D() returns normalized-metric coordinates. It does not return Unity world-space coordinates.

Use a Unity-side mapping or attachment component when you need to place GameObjects in the scene.

ViziverseAI SDK API reference.