66
66
#include < pxr/usd/usdPhysics/revoluteJoint.h>
67
67
#include < pxr/usd/usdPhysics/rigidBodyAPI.h>
68
68
#include < pxr/usd/usdPhysics/scene.h>
69
+ #include < pxr/usd/usdShade/material.h>
69
70
#include < pxr/usd/usdShade/materialBindingAPI.h>
70
71
namespace {
71
72
@@ -1136,19 +1137,8 @@ void ParseMjcPhysicsJointAPI(mjsJoint* mj_joint,
1136
1137
1137
1138
void ParseUsdPhysicsMaterialAPI (
1138
1139
mjsGeom* geom, const pxr::UsdPhysicsMaterialAPI& material_api) {
1139
- auto static_friction_attr = material_api.GetStaticFrictionAttr ();
1140
1140
auto dynamic_friction_attr = material_api.GetDynamicFrictionAttr ();
1141
- if (static_friction_attr.HasAuthoredValue ()) {
1142
- if (dynamic_friction_attr.HasAuthoredValue ()) {
1143
- mju_warning (
1144
- " Material %s has both static and dynamic friction authored, taking "
1145
- " the static value." ,
1146
- material_api.GetPath ().GetString ().c_str ());
1147
- }
1148
- float static_friction;
1149
- static_friction_attr.Get (&static_friction);
1150
- geom->friction [0 ] = static_friction;
1151
- } else if (dynamic_friction_attr.HasAuthoredValue ()) {
1141
+ if (dynamic_friction_attr.HasAuthoredValue ()) {
1152
1142
float dynamic_friction;
1153
1143
dynamic_friction_attr.Get (&dynamic_friction);
1154
1144
geom->friction [0 ] = dynamic_friction;
@@ -1205,10 +1195,6 @@ void ParseUsdPhysicsCollider(mjSpec* spec,
1205
1195
geom->contype = 1 ;
1206
1196
geom->conaffinity = 1 ;
1207
1197
1208
- if (prim.HasAPI <pxr::UsdPhysicsMassAPI>()) {
1209
- ParseUsdPhysicsMassAPIForGeom (geom, pxr::UsdPhysicsMassAPI (prim));
1210
- }
1211
-
1212
1198
if (prim.HasAPI <pxr::MjcPhysicsCollisionAPI>()) {
1213
1199
ParseMjcPhysicsCollisionAPI (geom, pxr::MjcPhysicsCollisionAPI (prim));
1214
1200
}
@@ -1225,6 +1211,13 @@ void ParseUsdPhysicsCollider(mjSpec* spec,
1225
1211
}
1226
1212
}
1227
1213
1214
+ // Parse the Mass API after the physics material APIs since the density attribute
1215
+ // from the Mass API is supposed to override the Material API density attribute.
1216
+ // See https://openusd.org/dev/api/usd_physics_page_front.html
1217
+ if (prim.HasAPI <pxr::UsdPhysicsMassAPI>()) {
1218
+ ParseUsdPhysicsMassAPIForGeom (geom, pxr::UsdPhysicsMassAPI (prim));
1219
+ }
1220
+
1228
1221
// Convert displayColor and displayOpacity to rgba.
1229
1222
// We want to support primvar inheritance, hence FindPrimvarWithInheritance.
1230
1223
pxr::UsdGeomPrimvarsAPI primvarsAPI (prim);
0 commit comments