Hi,
The viz.pick() command returns a Vizard node object. However, you are populating your
bodies list with your own
Ball objects, which are not node objects. You can iterate through the list and check if the node is equal to the
ball attribute of the
Ball class. Or you can have your
Ball class inherit from the Vizard node object. If you wanted to inherit from a Vizard node your
Ball class would look like this:
Code:
class Ball(viz.VizNode):
def __init__(self, alpha):
self.BALL_ALPHA = alpha
#Add the geometric representation of the ball
self.ball = viz.add('ball.wrl')
#Make ball twice as big
self.ball.scale(2,2,2)
#The balls collision will be represented by a sphere
self.ball.collideSphere()
#Set the alpha value of the ball
self.ball.alpha(self.BALL_ALPHA)
#Need to initialize base class
viz.VizNode.__init__(self,self.ball.id)