diff --git a/unity/Runtime/Components/Joints/MjJointSettings.cs b/unity/Runtime/Components/Joints/MjJointSettings.cs index f2f3d72e..1b9e87e9 100644 --- a/unity/Runtime/Components/Joints/MjJointSettings.cs +++ b/unity/Runtime/Components/Joints/MjJointSettings.cs @@ -164,7 +164,14 @@ namespace Mujoco { RefFriction.FromMjcf(mjcf, "solreffriction"); ImpFriction.FromMjcf(mjcf, "solimpfriction"); FrictionLoss = mjcf.GetFloatAttribute("frictionloss", 0.0f); - Limited = mjcf.GetBoolAttribute("limited", false); + + bool defaultLimited = false; + if (mjcf.OwnerDocument.GetElementsByTagName("compiler")[0] is not XmlElement + compilerElement || !compilerElement.GetBoolAttribute("autolimits").Equals("false")) { + defaultLimited = mjcf.HasAttribute("range"); + } + + Limited = mjcf.GetBoolAttribute("limited", defaultLimited); Margin = mjcf.GetFloatAttribute("margin", defaultValue: 0.0f); } }