How to rotate skeletons around global frame

When replaying skeleton data recorded from fusion of multiple cameras I see that the skeletons are not aligned with a horizontal plane (see image below). The image below is from replaying skeleton data in Unity, and it is tilted about 45 degrees off from the horizontal plane. In order to put surroundings around the avatars I need to rotate it to fit the rotation of the avatars, however, I would much rather want to rotate the avatars themselves. I am replaying skeleton data from a JSON file. How can I rotate all skeletons so that they align with the floor plane? Simply rotating the global root position of each avatar at each frame changes how the avatars are rotated relative to each other. The avatars must be rotated around a global axis. Changing the rotation of “FusionManager” (from stereolabs/zed-unity-livelink: ZED Livelink plugin for Unity (github.com) does not change the rotation of the avatars.

I therefore believe I have to somehow manually change the rotation (and corresponding position) manually to align the avatars correctly. How can I do so?

Hi,

I suppose the data has been recorded in Camera coordinate frame, and the camera was slightly looking downward. The skeleton data-position/orientation is therefore recorded relative to the camera position.
To fix that, you must know the pose of the camera and multiply the position/orientation of each kp by the inverse of the camera transform.

But to answer your question, the easier way to apply a global rotation to multiple objects in Unity is to create an Empty game object, set all the objects as children of this game object and rotate it accordingly.

Stereolabs Support

@BenjaminV @JPlou It doesn’t work creating a parent object to the avatars as it seems their positions are set as global positions. You can see me trying to edit the position of the “All nurses” parent object without it affecting the avatars position/rotation in the video below. I am using your Unity livelink sample ( stereolabs/zed-unity-livelink: ZED Livelink plugin for Unity (github.com)). Q:

  1. What do I need to edit to give the avatars positions locally with respect to its parent? I’ve tried changing the code in SkeletonHandler.cs UpdateAvatar() from transform.position to transform.localPosition and in MoveAvatar() from transform.SetPositionAndRotation to transform.SetLocalPositionAndRotation but it makes no difference.
  2. How must I alter the code if I instead should change rotation and position by multiplying with some orientation? The problem I’ve found previously doing that is that I rotate the avatar in place and not around a given point, so I get this funky movement as displayed in the video in this post: [Unity Livelink] Position and rotate avatars to the physical room - Stereolabs Forums

Video:

Tried this solution which does work in rotating around (0,0,0):

        // Add offsets to keypoint and global root orientation
        for (int i = 0; i < keypoint.Length; i++)
        {
            Vector3 initialPosition = keypoint[i];

            // RotateAround for keypoint
            initialPosition = Quaternion.Euler(0, liveRotationOffset.y, 0) * (initialPosition - Vector3.zero) + livePositionOffset;

            keypoint[i] = initialPosition;
        }

        // Do the same for global root orientation
        global_root_orientation = Quaternion.Euler(0, liveRotationOffset.y, 0) * global_root_orientation;

Interesting, but you’re not able to offset the position?

Can you try with the skeleton display instead of the avatars?
Maybe there’s an issue with the animator preventing this modification.