Unity skeleton flip

Hello, I’d like to know how can I flip the skeleton in Unity? Right now with the “BasicSkeleton” scene, I am moving my right hand and the skeleton in the screen is moving the right hand as well but from the user point of view is moving the hand on the left.

Thank you very much

Hi Dee,

Please take a look at our Animating the Avatar using Skeleton tutorial.

By default, the avatar directly repeats the user’s movements (for example, when the user raises the right hand, the avatar raises its right hand, too). If you want to mirror the movements of the avatar, download the MirrorFlipCamera script, drag-and-drop it to the Unity camera, and put the flipHorizontal tick in the Mirror Flip Camera (Script) section in the Inspector.

Here is the MirrorFlipCamera script.

Thank you very much for the answer, if anyone is looking for the same I also found another solution, I just added a new method in NuitrackUtils.cs below the existing ToVector3 method, and that worked perfectly fine for what I asked

`public static Vector3 ToVector3(this nuitrack.Joint joint)
{
    return new Vector3(joint.Real.X, joint.Real.Y, joint.Real.Z);
}

public static Vector3 ToVector3Flipped(this nuitrack.Joint joint)
{
    return new Vector3(joint.Real.X * -1f, joint.Real.Y, joint.Real.Z);
}`

I was looking for a mirroring solution too. I have no idea why Nuitrack doesn’t tell you anywhere to use the simple bool in the API under DepthSensor that makes this possible:
https://download.3divi.com/Nuitrack/doc/classtdv_1_1nuitrack_1_1DepthSensor.html#ab989236aa6834f9ebebbfceb6701cddd

"void tdv::nuitrack::DepthSensor::setMirror ( bool mirror )
inline
Set mirror mode state.

Call setMirror(true) to enable mirror mode. Call setMirror(false) to disable mirror mode.

If the mirror mode is on, the depth map from the sensor will be reflected horizontally before consequent processing.

Parameters
[in] mirror Mirror mode state to be set.
See also
isMirror"

Just make sure to call this method after Nuitrack.Init().

I also found this out. We use it as well. Not sure why they don’t recommend it.

Actually the documentation says, that you should be able to set the mirror option in the nuitrack.config. And it does as long as I edit the config directly. Unfortunatly it does not do anything, if I try to set it from code. But at least the other hidden option in the DepthSensor does.

nuitrack.Nuitrack.Init ();

//does not work!
//nuitrack.Nuitrack.SetConfigValue(“DepthProvider.Mirror”, “true”);

//works great
var sensor = nuitrack.DepthSensor.Create();
sensor.SetMirror(true);

1 Like