コード例 #1
0
 void UpdateGuideByTarget(bool rotateToTarget)
 {
     float[] newPos  = new float[3];
     float[] newQuat = new float[4];
     FKIKPlugin.UpdateGuideJointByTarget(m_id, FKIKPlugin.UnityToBVHTranslation(m_guideTarget.transform.position),
                                         newPos, newQuat);
     // Update guide
     gameObject.transform.position = FKIKPlugin.BVHToUnityTranslation(newPos);
     gameObject.transform.rotation = FKIKPlugin.BVHToUnityQuaternion(newQuat);
 }
コード例 #2
0
    // Set joints' localRotation and localPosition with JointData
    private void ApplyJointDataArray()
    {
        for (int i = 0; i < m_joints.Count; ++i)
        {
            FKIKPlugin.JointData data  = m_jointDataArray[i];
            GameObject           joint = m_idJointMap[data.id];
            joint.transform.localPosition = FKIKPlugin.BVHToUnityTranslation(data.localTranslation);
            joint.transform.localRotation = FKIKPlugin.BVHToUnityQuaternion(data.localRotation);
        }

        if (m_fixedRoot)
        {
            // Set root local position x and z to zero
            m_root.transform.localPosition = new Vector3(0, m_root.transform.localPosition.y, 0);
        }
    }