public override bool AreLimitsCorrect() { #if UNITY_2020_1_OR_NEWER ArticulationBody drive = GetComponent <ArticulationBody>(); return(drive.linearLockX == ArticulationDofLock.LimitedMotion && drive.xDrive.lowerLimit < drive.xDrive.upperLimit); #else HingeJointLimitsManager limits = GetComponent <HingeJointLimitsManager>(); return(limits != null && limits.LargeAngleLimitMin < limits.LargeAngleLimitMax); #endif }
protected override Joint.Limit ExportLimitData() { #if UNITY_2020_1_OR_NEWER ArticulationDrive drive = unityJoint.xDrive; return(new Joint.Limit(drive.lowerLimit * Mathf.Deg2Rad, drive.upperLimit * Mathf.Deg2Rad, drive.forceLimit, unityJoint.maxAngularVelocity)); #else HingeJointLimitsManager hingeJointLimits = GetComponent <HingeJointLimitsManager>(); return(new Joint.Limit( Math.Round(hingeJointLimits.LargeAngleLimitMin * Mathf.Deg2Rad, RoundDigits), Math.Round(hingeJointLimits.LargeAngleLimitMax * Mathf.Deg2Rad, RoundDigits), EffortLimit, VelocityLimit)); #endif }