View Single Post
  #1  
Old 09-01-2014, 03:31 PM
Notch Notch is offline
Member
 
Join Date: Jan 2014
Posts: 15
Detecting collision with on-the-fly object

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?
Reply With Quote