我正在使用MVN-Unity plug-in访问Xsens动作捕捉数据并实时动画Unity角色。白色和绿色和黄色字符是基于Xsens运动数据动画的Unity骨架。方向偏移
我现在试图使用Xsens(另一个看起来像人类的字符)与插件做类似的运动数据(位置为&方位)来动画不同的(非Unity)字符映射到他的关节/骨骼。
但正如你可以看到下面的东西是错误的方向......
我想原因可能是从MVN的旋转不正确的偏移。正如你在接下来的两张图片中看到的那样,MVN臀部的x轴(红色)指向木偶的后侧,而对于这个家伙的臀部,x轴指向他的右侧。
这也可能是插件是使用全球转的地方在那里它应该使用局部旋转。在我启动Unity应用程序之前,当我旋转身边的人时,可以证明这一点。即选择家伙的根游戏对象并尝试在按下游戏之前将y旋转设置为0/90/180/270,并比较结果:每次失真不同时。
我不知道如何正确解决这个问题。更新Unity模型的代码片段(映射到MVN puppet或guy)如下。我把这个从插件脚本:
private void updateModel(Transform[] pose, Transform[] model)
{
// Re-set the target, then set it up based on the segments.
Vector3 pelvisPos = new Vector3();
Vector3 lastPos = target.position;
target.position = Vector3.zero;
// Map only 23 joints.
for (int i = 0; i < 23; i++)
{
switch (i)
{
// Position only on y axis, and leave x and z to the body. Apply the 'global' position & orientation to the pelvis.
case (int)XsAnimationSegment.Pelvis:
pelvisPos = pose[i].position * scale;
model[i].position = new Vector3(model[i].position.x, pelvisPos.y, model[i].position.z);
model[i].rotation = pose[i].rotation * modelRotTP[i];
break;
// Update only the 'orientation' for the rest of the segments.
default:
if (model[i] != null)
{
model[i].rotation = pose[i].rotation * modelRotTP[i];
}
break;
}
}
// Apply root motion if the flag is enabled; i.e. true.
if (applyRootMotion)
{
// Only update x and z, since pelvis is already modified by y previously.
target.position = new Vector3(pelvisPos.x + pelvisPosTP.x, lastPos.y, pelvisPos.z + pelvisPosTP.z);
}
// Set the final rotation of the full body, but only position it to face similar as the pelvis.
Quaternion q = Quaternion.Inverse(modelRotTP[(int)XsAnimationSegment.Pelvis]) * model[(int)XsAnimationSegment.Pelvis].rotation;
target.rotation = new Quaternion(target.rotation.x, q.y, target.rotation.z, target.rotation.w);
}
我有点理解的代码做什么,但我不知道如何解决这个问题。最有可能与轴不同?我希望得到任何帮助......
@ Roberto Fuchs谢谢。我会试试这个。你使用Xsens-Unity插件吗?我在问,因为你指的是一条特定的路线。 – Joshua
是的,我在Oculus上使用Xsens-Unity插件 –
再次罗伯托,我只是现在就试试这个。您建议的修改是在'updateMvnActor'方法中。你是说(基于我的问题)在这种情况下'rotOffset'矢量是(-90,0,0)?我的理解正确吗? – Joshua