I'm using convex decomposition in V-rep and it works fine using GUI and Lua but for some reason it's not working when using C++. I get this message "Computing the convex decomposition (HACD)..."" and I have waited for hours and nothing happens. I'm using V-rep in Linux. I was wondering if I could get some help.
This is the code snippet that I used in Lua and it works:
Code: Select all
handle=sim.importShape(3, "Model.stl", 0, 1.0, 0.001);
result=sim.setObjectSpecialProperty(handle,sim.objectspecialproperty_collidable);
result=sim.setObjectInt32Parameter(handle,sim.shapeintparam_static,0);
result=sim.setObjectInt32Parameter(handle,sim.shapeintparam_respondable,1);
handle = sim.convexDecompose(handle, 25, {1,1000000,1000000,0,0,10000,20,4,4,20},{0.001,30,0.25,0.0,0.0,0.0025,0.05,0.05,0.00125,0.0001});
Code: Select all
int shapeHandle = -1;
int shapeDynHandle = -1;
int convDecomIntPams[] = {1,1000000,1000000,0,0,10000,20,4,4,20};
float convDecomFloatPams[] = {0.001,30,0.25,0.0,0.0,0.0025,0.05,0.05,0.00125,0.0001};
shapeDynHandle = simImportShape(3, "Model.stl", 3, 0.0, 0.001); // Import dynamic model
simSetObjectSpecialProperty(shapeDynHandle, sim_objectspecialproperty_collidable); // Object is collidable
simSetObjectInt32Parameter(shapeDynHandle,sim_shapeintparam_static,0); // Object is dynamic
simSetObjectInt32Parameter(shapeDynHandle,sim_shapeintparam_respondable,1); // Object is respondalbe
simSetObjectInt32Parameter(shapeDynHandle,sim_shapeintparam_convex,1);
shapeDynHandle = simConvexDecompose(shapeDynHandle, 25, convDecomIntPams, convDecomFloatPams); // Convex decomposition