Convert UsdPhysicsRevoluteJoint from degres to radians if compiler option is set.

PiperOrigin-RevId: 784574716
Change-Id: I58f65816edb782fcb41bbc721f7bed5a27741639
This commit is contained in:
Sam Haves
2025-07-18 07:17:25 -07:00
committed by Copybara-Service
parent 46b713ef2d
commit c2820941aa
+7 -4
View File
@@ -1380,10 +1380,13 @@ void ParseUsdPhysicsJoint(mjSpec* spec, const pxr::UsdPrim& prim, mjsBody* body,
if (revolute.GetLowerLimitAttr().Get(&lower) &&
revolute.GetUpperLimitAttr().Get(&upper)) {
mj_joint->limited = mjLIMITED_TRUE;
// As per the XML Reference, the default unit for mjSpec is degrees, so we
// don't need to convert from USD (which is degrees).
mj_joint->range[0] = lower;
mj_joint->range[1] = upper;
if (spec->compiler.degree) {
mj_joint->range[0] = lower;
mj_joint->range[1] = upper;
} else {
mj_joint->range[0] = lower * M_PI / 180.0;
mj_joint->range[1] = upper * M_PI / 180.0;
}
}
} else if (prim.IsA<pxr::UsdPhysicsPrismaticJoint>()) {
pxr::UsdPhysicsPrismaticJoint prismatic(prim);