I've been playing with plugins a bit and wanted to have access to the handle of a specific object in the scene which I know its name. How could I do this from inside the plugin?. In general, how could I obtain information from the simulation back into the plugin?. I've seen that in the OpenGL3 plugin in each message they receive a data pointer, and start grabbing the information from there, like this:
Code: Select all
if ( (message==sim_message_eventcallback_extrenderer_mesh)&&(currentOffscreen!=nullptr) )
{
// Collect mesh data from CoppeliaSim:
void** valPtr=(void**)data;
float* vertices=((float*)valPtr[0]);
int verticesCnt=((int*)valPtr[1])[0];
int* indices=((int*)valPtr[2]);
int triangleCnt=((int*)valPtr[3])[0];
float* normals=((float*)valPtr[4]);
int normalsCnt=((int*)valPtr[5])[0];
float* colors=((float*)valPtr[8]);
C7Vector tr(C4Vector((float*)valPtr[7]),C3Vector((float*)valPtr[6]));
bool textured=((bool*)valPtr[18])[0];
float shadingAngle=((float*)valPtr[19])[0];
bool translucid=((bool*)valPtr[21])[0];
float opacityFactor=((float*)valPtr[22])[0];
bool backfaceCulling=((bool*)valPtr[23])[0];
int geomId=((int*)valPtr[24])[0];
int texId=((int*)valPtr[25])[0];
unsigned char* edges=((unsigned char*)valPtr[26]);
bool visibleEdges=((bool*)valPtr[27])[0];
...