Add mjModel.ngravcomp, number of bodies with nonzero gravcomp attribute.

PiperOrigin-RevId: 627087335
Change-Id: Ie85ae4150962463b8a8c8435fec068c44877aa16
This commit is contained in:
Yuval Tassa
2024-04-22 10:44:33 -07:00
committed by Copybara-Service
parent 546a27ca72
commit 8ebc9ed2c8
8 changed files with 37 additions and 22 deletions
+1 -1
View File
@@ -175,7 +175,7 @@ static void mj_springdamper(const mjModel* m, mjData* d) {
// body-level gravity compensation, return 1 if any, 0 otherwise
static int mj_gravcomp(const mjModel* m, mjData* d) {
if (mjDISABLED(mjDSBL_GRAVITY) || mju_norm3(m->opt.gravity) == 0) {
if (!m->ngravcomp || mjDISABLED(mjDSBL_GRAVITY) || mju_norm3(m->opt.gravity) == 0) {
return 0;
}