View Single Post
  #8  
Old 07-16-2007, 02:27 PM
mjabon mjabon is offline
Member
 
Join Date: Jul 2007
Posts: 63
Quote:
Originally Posted by farshizzo View Post
Yes, the callbacks will still work when you are dragging an object. Like I mentioned above, you will need to explicitly enable collision notifications on an object for a callback to be triggered.
I have enabled collision on everything but it still never registers the callback. I did this:

made a bunch of screws and said this for each one:
Code:
screw.collideCapsule()
screw.enable(viz.COLLIDE_NOTIFY)
I also made a box:
Code:
currentBox.collideMesh()					#make a collision mesh so we know when screws hit it
currentBox.enable(viz.COLLIDE_NOTIFY)
Then I did this:

Code:
def onCollide(e):
	print "collision!"
	global allM1Screws, allM2Screws
	#Did a screw hit the box?
	if ((e.obj2 in allM1Screws) or (e.obj2 in allM2Screws)):
		#Change color of box
		e.obj1.color( random.choice( [viz.RED,viz.GREEN,viz.SKYBLUE,viz.YELLOW,viz.ORANGE,viz.PURPLE] ) )

        
viz.callback( viz.COLLIDE_BEGIN_EVENT, onCollide )


viz.collision(viz.ON)
I never enter the collision callback code

Last edited by mjabon; 07-16-2007 at 02:28 PM. Reason: forgot something
Reply With Quote