UnityEngine.XR.LegacyInputHelpers.ArmModel.CalculateFinalJointRotations(UnityEngine.Quaternion, UnityEngine.Quaternion, UnityEngine.Quaternion)

Here are the examples of the csharp api UnityEngine.XR.LegacyInputHelpers.ArmModel.CalculateFinalJointRotations(UnityEngine.Quaternion, UnityEngine.Quaternion, UnityEngine.Quaternion) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

19 View Source File : ArmModel.cs
License : MIT License
Project Creator : NicolasPCouts

protected virtual bool ApplyArmModel()
        {
            // Set the starting positions of the joints before they are transformed by the arm model.
            SetUntransformedJointPositions();

            // Get the controller's orientation.
            Quaternion controllerOrientation;
            Quaternion xyRotation;
            float xAngle;
            if (GetControllerRotation(out controllerOrientation, out xyRotation, out xAngle))
            {

                // Offset the elbow by the extension offset.
                float extensionRatio = CalculateExtensionRatio(xAngle);
                ApplyExtensionOffset(extensionRatio);

                // Calculate the lerp rotation, which is used to control how much the rotation of the
                // controller impacts each joint.
                Quaternion lerpRotation = CalculateLerpRotation(xyRotation, extensionRatio);

                CalculateFinalJointRotations(controllerOrientation, xyRotation, lerpRotation);
                ApplyRotationToJoints();
                m_FinalPose.position = m_ControllerPosition;
                m_FinalPose.rotation = m_ControllerRotation;
                return true;
            }
            return false;
        }