Add vertcollide option for adding spheres at flex vertices.
PiperOrigin-RevId: 757789990 Change-Id: I8ccba52b13e8c02a7be78f992297d6f414d98f8e
This commit is contained in:
committed by
Copybara-Service
parent
09bf5409ab
commit
d77126dc58
@@ -33,6 +33,7 @@
|
||||
#include "engine/engine_util_errmem.h"
|
||||
#include "user/user_flexcomp.h"
|
||||
#include <mujoco/mjspec.h>
|
||||
#include "user/user_api.h"
|
||||
#include "user/user_model.h"
|
||||
#include "user/user_objects.h"
|
||||
#include "user/user_resource.h"
|
||||
@@ -459,6 +460,14 @@ bool mjCFlexcomp::Make(mjsBody* body, char* error, int error_sz) {
|
||||
// add new body at vertex coordinates
|
||||
mjsBody* pb = mjs_addBody(body, 0);
|
||||
|
||||
// add geom if vertcollide
|
||||
if (dflex->vertcollide) {
|
||||
mjsGeom* geom = mjs_addGeom(pb, 0);
|
||||
geom->type = mjGEOM_SPHERE;
|
||||
geom->size[0] = dflex->radius;
|
||||
geom->group = 4;
|
||||
}
|
||||
|
||||
// set frame and inertial
|
||||
pb->pos[0] = point[3*i];
|
||||
pb->pos[1] = point[3*i+1];
|
||||
@@ -544,6 +553,13 @@ bool mjCFlexcomp::Make(mjsBody* body, char* error, int error_sz) {
|
||||
pb->inertia[2] = pb->mass*(2.0*inertiabox*inertiabox)/3.0;
|
||||
pb->explicitinertial = true;
|
||||
|
||||
// add geom if vertcollide
|
||||
if (dflex->vertcollide) {
|
||||
mjsGeom* geom = mjs_addGeom(pb, 0);
|
||||
geom->type = mjGEOM_SPHERE;
|
||||
geom->size[0] = dflex->radius;
|
||||
}
|
||||
|
||||
for (int d=0; d < 3; d++) {
|
||||
mjsJoint* jnt = mjs_addJoint(pb, 0);
|
||||
jnt->type = mjJNT_SLIDE;
|
||||
|
||||
Reference in New Issue
Block a user