Unity Ar foundation body tracking. Is it possible to track multiple bodies?

516 views Asked by At

If you use the latest version of AR foundation (I had to manually edit Packages/manifest.json to get it) and also have an iphone with an A12 processor or later, you can have body tracking.

You can track 3d or 2d human bodies. I am interested in the 2d tracking.

In Unity's demo they are using this line of code to get the human body data

var joints = m_HumanBodyManager.GetHumanBodyPose2DJoints(Allocator.Temp);

Which seems to only return info for one body even if the phone can see 2 or more. I am wondering if tracking multiple bodies is possible, some functions of the humanBodyManager class seem to hint at this being possible. eg.

This function

    OnTrackablesChanged(List<ARHumanBody>, List<ARHumanBody>, List<ARHumanBody>)

    List<ARHumanBody>   added   
    The list of human bodies added to the set of trackables.
    List<ARHumanBody>   updated            
    The list of human bodies updated in the set of trackables.
    List<ARHumanBody>   removed             
    The list of human bodies removed to the set of trackables.

and this event

public event Action<ARHumanBodiesChangedEventArgs> humanBodiesChanged

The event that is fired when a change to the detected human bodies is reported.

That function is protected, and I have tried subscribing to that event but it doesnt ever seem to be called. Its also very weird as its an event which wants to call functions which return an action that takes ARHumanBodiesChangedEventArgs as a paramater... I dunno why anyone would ever write a thing like that tbh.

Anyway writing visual debug code and then building to iOS to test all these semi documented classes is a massive pain. If someone could just let me know if multiple body tracking is even possible with ar foundation that would help me a lot. Thanks!

0

There are 0 answers