Fix body category check for mocap body descendants in visualization.

PiperOrigin-RevId: 856179240
Change-Id: I29f4758fee0ff3b16d0b9f452c28e640b5558993
This commit is contained in:
Yuval Tassa
2026-01-14 06:05:55 -08:00
committed by Copybara-Service
parent d387578783
commit f3ad0eff2b
2 changed files with 15 additions and 2 deletions
+2 -2
View File
@@ -153,9 +153,9 @@ static void mixcolor(float rgba[4], const float ref[4], int flg1, int flg2) {
}
// a body is static if it is welded to the world and is not a mocap body
// a body is static if it is welded to the world and is not a mocap body or descendant thereof
static int bodycategory(const mjModel* m, int bodyid) {
if (m->body_weldid[bodyid] == 0 && m->body_mocapid[bodyid] == -1) {
if (m->body_weldid[bodyid] == 0 && m->body_mocapid[m->body_rootid[bodyid]] == -1) {
return mjCAT_STATIC;
} else {
return mjCAT_DYNAMIC;
+13
View File
@@ -0,0 +1,13 @@
<mujoco>
<worldbody>
<light pos="0 0 2"/>
<geom type="plane" size="1 1 0.1"/>
<body mocap="true">
<geom size=".1"/>
<body pos="0 0 .05">
<geom size=".1" pos="0 0 .1"/>
</body>
</body>
</worldbody>
</mujoco>