Ejemplo n.º 1
0
        private void UpdateIKGoal(IKGoal goal)
        {
            IKTarget bestIKTarget = goal.GetBestIKTarget();

            Transform targetTransform = bestIKTarget != null ? bestIKTarget.ikTargetTransform : null;
            float     positionWeight  = bestIKTarget != null ? bestIKTarget.positionWeight : 0f;
            float     rotationWeight  = bestIKTarget != null ? bestIKTarget.rotationWeight : 0f;

            switch (goal.VRIKGoal)
            {
            case VRIKGoal.LEFT_ARM:
            {
                _vrik.solver.leftArm.target         = targetTransform;
                _vrik.solver.leftArm.positionWeight = positionWeight;
                _vrik.solver.leftArm.rotationWeight = rotationWeight;
                break;
            }

            case VRIKGoal.RIGHT_ARM:
            {
                _vrik.solver.rightArm.target         = targetTransform;
                _vrik.solver.rightArm.positionWeight = positionWeight;
                _vrik.solver.rightArm.rotationWeight = rotationWeight;
                break;
            }

            case VRIKGoal.LEFT_LEG:
            {
                _vrik.solver.leftLeg.target         = targetTransform;
                _vrik.solver.leftLeg.positionWeight = positionWeight;
                _vrik.solver.leftLeg.rotationWeight = rotationWeight;
                break;
            }

            case VRIKGoal.RIGHT_LEG:
            {
                _vrik.solver.rightLeg.target         = targetTransform;
                _vrik.solver.rightLeg.positionWeight = positionWeight;
                _vrik.solver.rightLeg.rotationWeight = rotationWeight;
                break;
            }
            }
        }
Ejemplo n.º 2
0
        private void ResetIKGoal(IKGoal goal)
        {
            switch (goal.VRIKGoal)
            {
            case VRIKGoal.LEFT_ARM:
            {
                _vrik.solver.leftArm.target         = null;
                _vrik.solver.leftArm.positionWeight = 0f;
                _vrik.solver.leftArm.rotationWeight = 0f;
                break;
            }

            case VRIKGoal.RIGHT_ARM:
            {
                _vrik.solver.rightArm.target         = null;
                _vrik.solver.rightArm.positionWeight = 0f;
                _vrik.solver.rightArm.rotationWeight = 0f;
                break;
            }

            case VRIKGoal.LEFT_LEG:
            {
                _vrik.solver.leftLeg.target         = null;
                _vrik.solver.leftLeg.positionWeight = 0f;
                _vrik.solver.leftLeg.rotationWeight = 0f;
                break;
            }

            case VRIKGoal.RIGHT_LEG:
            {
                _vrik.solver.rightLeg.target         = null;
                _vrik.solver.rightLeg.positionWeight = 0f;
                _vrik.solver.rightLeg.rotationWeight = 0f;
                break;
            }
            }
        }