user414025
user414025

Reputation: 105

Unity3D Leap Motion - Transform a hand to the same position & rotation as another

I have two copies of a left hand from two different leap motion sensors and i am trying to transform the one to match the position and rotation of the other.

I'm currently using the following code to visualize it:

Hand temp = new Hand().CopyFrom(averaged[key2].LeftHand);
temp.SetTransform(averaged[key1].LeftHand.PalmPosition.ToVector3(),averaged[key1].LeftHand.Rotation.ToQuaternion());

foreach (Finger f in temp.Fingers)
{
  foreach (Bone b in f.bones)
  {
    Debug.DrawLine(b.PrevJoint.ToVector3(),
      b.NextJoint.ToVector3(),Colors.OrangeCrayola);
  }
}

The problem is that the hands rotation doesn't line up as it should.

Upvotes: 0

Views: 407

Answers (1)

RoryGames
RoryGames

Reputation: 21

Aligning hands is found within the script https://github.com/leapmotion/UnityModules/blob/feat-multi-device/Assets/LeapMotion/Core/Scripts/Utils/MultideviceAlignment.cs

Attach that to the same object as one of your service provider scripts and assign the collection and solve keybinds. It will align the different leaps based on the right hand as long as it is visible to both of them. You'll need to press the collection button first, then the solve button.

Upvotes: 1

Related Questions