I have generated on-the-fly cylinders using
vizshape.addCylinder(). I would like to detect collisions with a specific cylinder.
I am able to detect collisions with objects using
viz.callback(viz.COLLISION_EVENT,onCollision). I can get the name of the object collided with by using the following code:
Code:
def onCollision(info):
print('Collided with object',info.object)
Although this returns something like
"Collided with object viz.VizPrimitive(9)", but I have way knowing what 'VizPrimitive(9)' is. I have several objects in the scene, and ideally would like to add names to the objects at the time they are created, so that I can then work out what I'm colliding with later on.
How do I name on-the-fly objects, and how do I then get the name of the object when a collision occurs?