-
Notifications
You must be signed in to change notification settings - Fork 332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added PuppetAvatar.cs Script #52
Conversation
Thanks for this @anantley. Any chance you have a script that also works with the RocketBox Avatars recently released? I tried and all I got was a contortionist and had a hard time figuring out the right values to apply. RocketBox Avatars repo: https://github.com/microsoft/Microsoft-Rocketbox |
@anantley This might be helpful for the RocketBox Avatars to get each joint based on JointId. My problem was mainly with getting rotation and position right. The sample uses a flat hierarchy whereas Rocketbox is more "intricate": private Transform GetJoint(JointId id)
{
if(id == JointId.Pelvis)
{
return transform.Find("Bip01").Find("Bip01 Pelvis");
}
else if(id == JointId.SpineNavel)
{
return GetJoint(JointId.Pelvis).Find("Bip01 Spine");
}
else if(id == JointId.SpineChest)
{
return GetJoint(JointId.SpineNavel).Find("Bip01 Spine1").Find("Bip01 Spine2");
}
else if(id == JointId.Head)
{
return GetJoint(JointId.Neck).Find("Bip01 Head");
}
else if(id == JointId.Neck)
{
return GetJoint(JointId.SpineChest).Find("Bip01 Neck");
}
else if(id == JointId.ClavicleLeft)
{
return GetJoint(JointId.Neck).Find("Bip01 L Clavicle");
}
else if(id == JointId.ClavicleRight)
{
return GetJoint(JointId.Neck).Find("Bip01 R Clavicle");
}
else if(id == JointId.ShoulderLeft)
{
return GetJoint(JointId.ClavicleLeft).Find("Bip01 L UpperArm");
}
else if(id == JointId.ShoulderRight)
{
return GetJoint(JointId.ClavicleRight).Find("Bip01 R UpperArm");
}
else if(id == JointId.ElbowLeft)
{
return GetJoint(JointId.ShoulderLeft).Find("Bip01 L Forearm");
}
else if(id == JointId.ElbowRight)
{
return GetJoint(JointId.ShoulderRight).Find("Bip01 R Forearm");
}
else if(id == JointId.WristLeft)
{
return GetJoint(JointId.ElbowLeft).Find("Bip01 L Hand");
}
else if(id == JointId.WristRight)
{
return GetJoint(JointId.ElbowRight).Find("Bip01 R Hand");
}
else if(id == JointId.HipLeft)
{
return GetJoint(JointId.SpineNavel).Find("Bip01 L Thigh");
}
else if(id == JointId.HipRight)
{
return GetJoint(JointId.SpineNavel).Find("Bip01 R Thigh");
}
else if(id == JointId.KneeLeft)
{
return GetJoint(JointId.HipLeft).Find("Bip01 L Calf");
}
else if(id == JointId.KneeRight)
{
return GetJoint(JointId.HipRight).Find("Bip01 R Calf");
}
else if(id == JointId.AnkleLeft)
{
return GetJoint(JointId.KneeLeft).Find("Bip01 L Foot");
}
else if(id == JointId.AnkleRight)
{
return GetJoint(JointId.KneeRight).Find("Bip01 R Foot");
}
else if(id == JointId.FootLeft)
{
return GetJoint(JointId.AnkleLeft).Find("Bip01 L Toe0");
}
else if(id == JointId.AnkleRight)
{
return GetJoint(JointId.FootRight).Find("Bip01 R Toe0");
}
return null;
} |
@anantley Here is the model The first model has a -90 x rotation on the root and a 90 y rotation on the pelvis. The second model has a -90 x rotation on the Bip01 (root) and a -90 x rotation on the Bio01 Pelvis. |
Tested another rig that was Parent gameObject : Pelvis and that one worked, versus the ones that are Parent gameObject : root : pelvis, which did not. |
@dotMorten
Let me know if you have any problems with that |
@genereddick @dotMorten I made a new version of the puppetmaster.cs script that should handle all the cases with the extra root nodes above the pelvis. It would be great if you could try them out on your problem avatars and let me know what happens. |
@anantley I tested with three different avatars. The one that was working previously and the two with the parent:root:pelvis hierarchy. All three work with the correct rotations. Thanks! Not a serious issue but there is an short period between when the project starts and the body tracking rotations are first applied where the two (previously non-working) models jump to their incorrect rotations before correcting. |
One thing I did have a problem with was that the character doesn't move around. Ie if I walk a step forward, the character doesn't move a step forward. On the upside, I can moonwalk now :) |
Hi @dotMorten did you solve that? I have the translations working too if you are interested Mar |
@margonzalezfrance nope I didn't. Would love to hear how you solved it. |
@margonzalezfrance I'm also interested |
Hi, In the late update after updating all the joins of the avatar you have to translate the pelvis if (currentbone.name == RootPosition.name) For everyone here, we will be releasing a new animator tool specific for rocketbox in unity |
Thanks for all the working basics, examples and scripts! |
Hi @ElliMary can you tell me what your gpu is? That can make a big difference for latency. |
Hi @anantley, my GPU is NVIDIA GeForce RTX 2070 SUPER. |
Any updates on this? I am currently working on a project where I have multiple skeletons - and I want to add separate avatars on top of them. Currently all my avatars are following the motion of one skeleton. |
Added script to apply joint rotations from Azure Kinect to any humanoid avatar in Unity.
The steps to apply are:
Still to do: