In #45 each figure have been provided by a idLocal in a way to access the right figure on the structure ptrDebugDrawingsScene->geom. When a geom object mjvGeom is added there, it will be displayed in the simulator. The idLocal have been added because I could not figure out how to retreive the right mjvGeom when two object with the same type mjvGeom.type have been instantiated (i.e. initializated and put into the structure ptrDebugDrawingsScene->geom ): in any case the variable idLocal provide a secure acces the right mjvGeom into ptrDebugDrawingsScene->geom.
DebugDrawings::drawSphere(0, P1, 0.3, color);
DebugDrawings::drawCylinder(0, P2, 0.3, 0.4, color);
Actually if two different call of drawing have the same idLocal, they mix up and the first one is 'cancelled' by the second call of the drawing the the same idLocal ( so we will see a cylynder spawning and not the sphere ). We need to find a robust way to ensure uniqueness of idLocal so that in the above code only the sphere will be spawned and not the cylinder.
EDIT ( suggestion ): this check may be done into the init function checking if the ID already exist before initialize it
In #45 each figure have been provided by a
idLocalin a way to access the right figure on the structureptrDebugDrawingsScene->geom. When a geom objectmjvGeomis added there, it will be displayed in the simulator. TheidLocalhave been added because I could not figure out how to retreive the rightmjvGeomwhen two object with the same typemjvGeom.typehave been instantiated (i.e. initializated and put into the structureptrDebugDrawingsScene->geom): in any case the variableidLocalprovide a secure acces the rightmjvGeomintoptrDebugDrawingsScene->geom.Actually if two different call of drawing have the same
idLocal, they mix up and the first one is 'cancelled' by the second call of the drawing the the sameidLocal( so we will see a cylynder spawning and not the sphere ). We need to find a robust way to ensure uniqueness ofidLocalso that in the above code only the sphere will be spawned and not the cylinder.EDIT ( suggestion ): this check may be done into the init function checking if the ID already exist before initialize it