Exemple #1
0
        public void WritePose(IKSolverFullBody solver, bool fullBody)
        {
            if (weight <= 0f)
            {
                return;
            }

            // Swing the parent bone to look at the first node's position
            if (fullBody)
            {
                if (parentBone != null)
                {
                    boneMapParent.Swing(solver.GetNode(boneMap1.chainIndex, boneMap1.nodeIndex).solverPosition, weight);
                    //boneMapParent.Swing(boneMap1.node.solverPosition, weight);
                }

                // Fix the first bone to it's node
                boneMap1.FixToNode(solver, weight);
            }

            // Rotate the 2 first bones to the plane points
            boneMap1.RotateToPlane(solver, weight);
            boneMap2.RotateToPlane(solver, weight);

            // Rotate the third bone to the rotation it had before solving
            boneMap3.RotateToMaintain(maintainRotationWeight * weight * solver.IKPositionWeight);

            // Rotate the third bone to the effector rotation
            boneMap3.RotateToEffector(solver, weight);
        }
Exemple #2
0
        public void WritePose()
        {
            float w = solver.GetIKPositionWeight();

            if (w <= 0)
            {
                return;
            }

            // Swing the parent bone to look at the first node's position
            if (parentBone != null)
            {
                boneMapParent.Swing(boneMap1.node.solverPosition, w * weight);
            }

            // Fix the first bone to it's node
            boneMap1.FixToNode(w * weight);

            // Rotate the 2 first bones to the plane points
            LocalSlerp(boneMap1, w);
            LocalSlerp(boneMap2, w);

            // Rotate the third bone to the rotation it had before solving
            boneMap3.RotateToMaintain(w * maintainRotationWeight * weight);

            // Rotate the third bone to the effector rotation
            boneMap3.RotateToEffector(w * weight);
        }