Geoms of type mesh with zero density don't trigger the check for valid mesh volume.
PiperOrigin-RevId: 629416817 Change-Id: I23eaa0d61a703988a4eb96a3cad09e562384035e
This commit is contained in:
committed by
Copybara-Service
parent
26f23066d1
commit
6f97f42458
@@ -2344,6 +2344,7 @@ void mjCGeom::Compile(void) {
|
||||
|
||||
// compute geom mass and inertia
|
||||
if (inferinertia) {
|
||||
// mass is defined
|
||||
if (mjuu_defined(mass)) {
|
||||
if (mass==0) {
|
||||
mass_ = 0;
|
||||
@@ -2353,11 +2354,19 @@ void mjCGeom::Compile(void) {
|
||||
density = mass / GetVolume();
|
||||
SetInertia();
|
||||
}
|
||||
} else {
|
||||
mass_ = density * GetVolume();
|
||||
SetInertia();
|
||||
}
|
||||
|
||||
// mass is not defined
|
||||
else {
|
||||
if (density == 0) {
|
||||
mass_ = 0;
|
||||
} else {
|
||||
mass_ = density * GetVolume();
|
||||
SetInertia();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// check for negative values
|
||||
if (mass_<0 || inertia[0]<0 || inertia[1]<0 || inertia[2]<0 || density<0)
|
||||
throw mjCError(this, "mass, inertia or density are negative in geom");
|
||||
|
||||
Reference in New Issue
Block a user