Exemple #1
0
 void UpdateJoints(Body a_body)
 {
     foreach (var l_joint in i_jointsMap)
     {
         i_jointsMap[l_joint.Key].transform.position = BodySourceManager.CSPtoVector3(a_body.Joints[l_joint.Key].Position);
         i_jointsMap[l_joint.Key].transform.rotation = BodySourceManager.JointOrientationToQuatertnion(a_body.JointOrientations[l_joint.Key]);
     }
 }
Exemple #2
0
 void UpdateBones(Body a_body)
 {
     foreach (var l_bone in i_bonesMap)
     {
         Vector3 boneStartPos = BodySourceManager.CSPtoVector3(a_body.Joints[l_bone.Key[0]].Position);
         Vector3 boneEndPos   = BodySourceManager.CSPtoVector3(a_body.Joints[l_bone.Key[1]].Position);
         Vector3 dif          = boneEndPos - boneStartPos;
         l_bone.Value.transform.forward    = dif.normalized;
         l_bone.Value.transform.localScale = new Vector3(bone.transform.localScale.x, bone.transform.localScale.y, dif.magnitude);
         l_bone.Value.transform.position   = (boneStartPos + boneEndPos) / 2.0f;
     }
 }
    private Vector3 CalculateDragPivotPoint()
    {
        Vector3 l_result = Vector3.zero;
        Body    l_body   = null;

        if ((l_body = bodyManager.firstTrackedBody) != null)
        {
            l_result = BodySourceManager.CSPtoVector3(l_body.Joints[JointType.SpineMid].Position);
            l_result = new Vector3(l_result.x, 0f, l_result.z);
        }

        return(l_result);
    }