Example #1
0
        private void FixedUpdate()
        {
            if ((angularJoint != null && !angularJoint.jointCreated) || (angularJoint == null && joint == null))
            {
                return;
            }
            if (angularJoint != null)
            {
                angle = angularJoint.GetValue();
            }
            else
            {
                angle = joint.GetXAngle(invInitialLocalRotation);
            }
            float num = 0f;

            if (angle < fromDeadAngle)
            {
                num = ((!discrete) ? (0f - Mathf.InverseLerp(fromDeadAngle, fromAngle, angle)) : (-1f));
            }
            if (angle > toDeadAngle)
            {
                num = ((!discrete) ? Mathf.InverseLerp(toDeadAngle, toAngle, angle) : 1f);
            }
            if (respringBlock > 0f)
            {
                respringBlock -= Time.fixedDeltaTime;
                if (respringBlock > 0f)
                {
                    return;
                }
            }
            if (output.value != num)
            {
                output.SetValue(num);
                if (snapTo.connectedNode == null)
                {
                    CheckSnap(num, forcePosition: false);
                }
            }
        }
 protected override float GetActualPosition()
 {
     return(joint.GetXAngle(invInitialLocalRotation) - initialValue);
 }