Add passive collision mode for flexes.

PiperOrigin-RevId: 801754907
Change-Id: I4147af2ee2596519d42cb9a03cf8d5488f0bc3e8
This commit is contained in:
Alessio Quaglino
2025-09-01 04:13:07 -07:00
committed by Copybara-Service
parent b9900db00e
commit 8acd83f317
17 changed files with 320 additions and 134 deletions
+10 -4
View File
@@ -316,9 +316,9 @@ const char* MJCF[nMJCF][mjXATTRNUM] = {
{"<"},
{"edge", "?", "5", "equality", "solref", "solimp", "stiffness", "damping"},
{"elasticity", "?", "5", "young", "poisson", "damping", "thickness", "elastic2d"},
{"contact", "?", "14", "contype", "conaffinity", "condim", "priority",
{"contact", "?", "15", "contype", "conaffinity", "condim", "priority",
"friction", "solmix", "solref", "solimp", "margin", "gap",
"internal", "selfcollide", "activelayers", "vertcollide"},
"internal", "selfcollide", "activelayers", "vertcollide", "passive"},
{"pin", "*", "4", "id", "range", "grid", "gridrange"},
{"plugin", "*", "2", "plugin", "instance"},
{"<"},
@@ -332,9 +332,9 @@ const char* MJCF[nMJCF][mjXATTRNUM] = {
{"flex", "*", "13", "name", "group", "dim", "radius", "material",
"rgba", "flatskin", "body", "vertex", "element", "texcoord", "elemtexcoord", "node"},
{"<"},
{"contact", "?", "14", "contype", "conaffinity", "condim", "priority",
{"contact", "?", "15", "contype", "conaffinity", "condim", "priority",
"friction", "solmix", "solref", "solimp", "margin", "gap",
"internal", "selfcollide", "activelayers", "vertcollide"},
"internal", "selfcollide", "activelayers", "vertcollide", "passive"},
{"edge", "?", "2", "stiffness", "damping"},
{"elasticity", "?", "5", "young", "poisson", "damping", "thickness", "elastic2d"},
{">"},
@@ -1460,6 +1460,9 @@ void mjXReader::OneFlex(XMLElement* elem, mjsFlex* flex) {
if (MapValue(cont, "vertcollide", &flex->vertcollide, bool_map, 2)) {
flex->vertcollide = (n == 1);
}
if (MapValue(cont, "passive", &flex->passive, bool_map, 2)) {
flex->passive = (n == 1);
}
ReadAttrInt(cont, "activelayers", &flex->activelayers);
}
@@ -2721,6 +2724,9 @@ void mjXReader::OneFlexcomp(XMLElement* elem, mjsBody* body, const mjVFS* vfs) {
if (MapValue(cont, "vertcollide", &n, bool_map, 2)) {
dflex.vertcollide = (n == 1);
}
if (MapValue(cont, "passive", &n, bool_map, 2)) {
dflex.passive = (n == 1);
}
ReadAttrInt(cont, "activelayers", &dflex.activelayers);
}