Scaling Avatars in Unity

Hi, the avatars in unity body tracking are all created with the same height. I would like to scale them depending on the hight of the person and have thought of 2 possibilities:
1.) get the height from the dimensions and scale the humanoid accordingly. Question: How can I get the dimensions of the bounding box in the Create() function in SkeletonHandler.cs?

2.) Add the lengths of the individual bones and thus determine the height. Question: Is it possible to get the length of the bones in the Create() function or is this the wrong place for it?

Hi,

The “Create” function is called in the “InstanciateAvatarWithDelay” function from the ZEDBodyTrackingManager script which has access all the body tracking data stored in the “DetectedBody” structure.
This contains both the bounding box size and the position of each joint you can use to calculate the size of each bone.

Stereolabs Support

Thanks, that helped a lot.
I have another unrelated question. Is it possible to show only the zed camera video in the small canvas in unity? By default there is an overlay between the camera video and the unity scene but I would like to have just the camera video shown in there (like it is in Unreal Engine).

Hi,
I’m sorry I do not understand your question.
Could you explain me again what you are trying to achieve please?

In Unity, there is a second canvas inside the actual view, as in this example


In this smaller canvas I would like to have the “real world” camera video from the ZED. But it looks to me like there is an overlap between the Unity scene and the real world video. So if my Unity scene is not empty as in the picture above, the video in the canvas looks really bad because virtual and physical objects overlap. So the question is, how can I just show the actual original video in this small canvas, ignoring any game objects from Unity?

I’m sorry but I still don’t understand.

The canvas already contains the ZED Camera images, am I missing something?

Yes, it contains the ZED camera images. But it also contains the virtual elements from Unity and mixes them together, if I understand the documentation correctly:


What I am trying to achieve is to have only the ZED camera images.

I think my problem is similar to his here Unity: Custom avatar displayed on virtual canvas
But adding the “tagInvisibleToZED” tag to the Unity objects did not work in my case.

Ok I understand now, thanks again for your patience.

I just tested adding the “tagInvisibleToZED” tag and it seems to work.

Did you add the tag to the game object and all his children (if it has any)?

Thanks, I did not add it to the children, it seems to work now. But now the objects have disappeared from the main view as well:


Is there a way to keep it there and just remove it from the small canvas?

Can you check if on the main camera, the tag is set in the occlusion culling setting ?

image

It seems that my settings look a bit different from yours, but the tag is set in the culling mask setting.
image

I suppose you are either using URP or HDRP, that’s why it’s slightly different but I don’t think it matters.

I realized the ground plane is also not visible. Was it the case since the beginning, even before you changed the tags?

Yes, I use HDRP. Sorry, I removed the plane temporarily, but I just had a look and for the plane object everything works as expected (visible in main view, not visible in small canvas).

Edit: I have found the issue, it was due to a specific setting of my custom object. Thanks for your help!

Ok, that means tagging the objects is working, but something else is hiding them for the main view.

I might be a silly question, but are you sure they are in front of the camera? I run out of ideas.

Edit : Well ok I did not see your post update, glad to hear it works now !

Stereolabs Support

1 Like