Unity Body Tracking Avatar Scaling according to the skeleton scale

Hi there,

I found that the skeleton and the avatar are not matched. Is it possible to make the scale align?



The skeleton size matches the size of the detected person on the image when the avatar has a fixed size. If the real person and the avatar do not have the same size, there will be a difference as you have here.

Scaling the avatar is something possible, however, we do not provide this feature out of the box for now.


Thanks for the reply.
I would like to ask in which way I could make this happen?
For example, do I need to modify the ZEDBodyTrackingManager.cs?

Thanks again


To resize the avatar, you will have to apply a scale to it.
I suppose it depends if you wish to rescale the global scale of the avatar of the scale of the bone individually.
The first will be probably much easier to do, but I’m not sure which method is the best one.

In any case, I think it should be done during the instanciation of the avatar, in the “create” method : https://github.com/stereolabs/zed-unity/blob/master/ZEDCamera/Assets/ZED/SDK/Helpers/Scripts/BodyTracking/SkeletonHandler.cs#L532.

I have another question as per below:

The avatar’s lower part behaves not so naturally when I get closer to the camera.
Is there any way to improve this issue?

Thanks again

This happens because your legs are not visible by the camera. If you look at the image on the top left, your feet are not visible at all. To have the best quality possible, make sure you are fully visible by the camera.

One more thing, thanks for your suggestion.
I have added a new line to modify the scale of the instantiation as below, it works.
humanoid = (GameObject)Instantiate(h, Vector3.zero, Quaternion.identity);
humanoid.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);
And I saw that it is possible to call the API about dimension. Is it possible to call the height value so that I could make the scale reference to the height?


The dimension is representing the height, width, length of the bounding box surrounding the skeleton.It will give you an approximate idea of the size of the person.
The more accurate way would be to add up all the bones from the feet to the head, giving you the “real” size of the detected person.
You also have to make sure that the person is fully visible when doing that, otherwise your value will be off.

In the SkeletonHandler.cs

Could I know the relationship between the Avatar Spawn and the Skeleton_ID?
Is there any memory stored to match the Avatar and Skeleton to align their motion?

On the other hand, the Skeleton_ID is not in sequence sometime. Is there is list to store the ID memory? Cause while I stopped the Editor Runtime and restart, the ID number did not clear.


The problem we are facing here is
Even we got the bones size as you suggested, if we wanna scale the avatar accordingly, we still need to know which skeleton belongs to which character. It would be great that if you can tell us how the SDK handle the matching part, and how we can get use of the function.

Also, wanna check if there is way to toggle between the body control in runtime?


It would be good to that I can get scale.y of the one cylinder created by the SkeletonHandler.cs
Where can I find out the reference value within the code of SDK?
Since I just want to make a scale difference according to the body tracked instead of “real” size.


Hi again,
As per the below screenshot,

The skeleton is not aligned with the motion of the avatar. you can see the legs were bended.
Could you please tell me why this issue happened and how to prevent it?


@taksheep Each detection has its own ID, it can be used to know which avatar corresponds to which detection.

@dragonxii2002 The skeleton is created and updated here : https://github.com/stereolabs/zed-unity/blob/master/ZEDCamera/Assets/ZED/SDK/Helpers/Scripts/BodyTracking/SkeletonHandler.cs#L686