示例#1
0
        public override bool AreLimitsCorrect()
        {
#if UNITY_2020_1_OR_NEWER
            ArticulationBody joint = GetComponent <ArticulationBody>();
            return(joint.linearLockX == ArticulationDofLock.LimitedMotion && joint.xDrive.lowerLimit < joint.xDrive.upperLimit);
#else
            PrismaticJointLimitsManager limits = GetComponent <PrismaticJointLimitsManager>();
            return(limits != null && limits.PositionLimitMin < limits.PositionLimitMax);
#endif
        }
示例#2
0
        protected override Joint.Limit ExportLimitData()
        {
#if UNITY_2020_1_OR_NEWER
            ArticulationDrive drive = GetComponent <ArticulationBody>().xDrive;
#if UNITY_2020_2_OR_NEWER
            return(new Joint.Limit(drive.lowerLimit, drive.upperLimit, drive.forceLimit, unityJoint.maxLinearVelocity));
#elif UNITY_2020_1
            return(new Joint.Limit(drive.lowerLimit, drive.upperLimit, drive.forceLimit, maxLinearVelocity));
#endif
#else
            PrismaticJointLimitsManager prismaticLimits = GetComponent <PrismaticJointLimitsManager>();
            return(new Joint.Limit(
                       Math.Round(prismaticLimits.PositionLimitMin, RoundDigits),
                       Math.Round(prismaticLimits.PositionLimitMax, RoundDigits),
                       EffortLimit,
                       VelocityLimit));
#endif
        }