Use plane-convex for plane-sdf collisions, using the marching cube mesh.

PiperOrigin-RevId: 629437563
Change-Id: Ic7fb6ec8a5c6680dd2c0a71baa7cc78636d478b1
This commit is contained in:
Alessio Quaglino
2024-04-30 09:28:17 -07:00
committed by Copybara-Service
parent 6f97f42458
commit ec84ddb5a4
3 changed files with 4 additions and 2 deletions
+1
View File
@@ -163,6 +163,7 @@ void mjccd_support(const void *obj, const ccd_vec3_t *_dir, ccd_vec3_t *vec) {
break;
case mjGEOM_MESH:
case mjGEOM_SDF:
// init search
vertdata = m->mesh_vert + 3*m->mesh_vertadr[m->geom_dataid[g]];
tmp = -1E+10;
+1 -1
View File
@@ -40,7 +40,7 @@
// table of pair-wise collision functions
mjfCollision mjCOLLISIONFUNC[mjNGEOMTYPES][mjNGEOMTYPES] = {
/* PLANE HFIELD SPHERE CAPSULE ELLIPSOID CYLINDER BOX MESH SDF */
/*PLANE */ {0, 0, mjc_PlaneSphere, mjc_PlaneCapsule, mjc_PlaneConvex, mjc_PlaneCylinder, mjc_PlaneBox, mjc_PlaneConvex, mjc_SDF},
/*PLANE */ {0, 0, mjc_PlaneSphere, mjc_PlaneCapsule, mjc_PlaneConvex, mjc_PlaneCylinder, mjc_PlaneBox, mjc_PlaneConvex, mjc_PlaneConvex},
/*HFIELD */ {0, 0, mjc_ConvexHField, mjc_ConvexHField, mjc_ConvexHField, mjc_ConvexHField, mjc_ConvexHField, mjc_ConvexHField, mjc_HFieldSDF},
/*SPHERE */ {0, 0, mjc_SphereSphere, mjc_SphereCapsule, mjc_Convex, mjc_SphereCylinder, mjc_SphereBox, mjc_Convex, mjc_SDF},
/*CAPSULE */ {0, 0, 0, mjc_CapsuleCapsule, mjc_Convex, mjc_Convex, mjc_CapsuleBox, mjc_Convex, mjc_SDF},
+2 -1
View File
@@ -3213,7 +3213,8 @@ void mjCModel::TryCompile(mjModel*& m, mjData*& d, const mjVFS* vfs) {
// mark meshes that need convex hull
for (int i=0; i<geoms.size(); i++) {
if (geoms[i]->mesh && geoms[i]->spec.type==mjGEOM_MESH &&
if (geoms[i]->mesh &&
(geoms[i]->spec.type==mjGEOM_MESH || geoms[i]->spec.type==mjGEOM_SDF) &&
(geoms[i]->spec.contype || geoms[i]->spec.conaffinity)) {
geoms[i]->mesh->set_needhull(true);
}