View Single Post
  #6  
Old 05-13-2009, 12:09 AM
nasr nasr is offline
Member
 
Join Date: Apr 2009
Posts: 27
paul thank you very much for your reply.this is my full program
Code:
import viz

viz.go()

viz.MainView.setPosition(0,1.5,-4)
import viztracker
tracker = viztracker.MousePos()
myroom=viz.add('room.wrl')
#Add the object that will do the grabbing and link it to the tracker
hand = viz.add('marker.wrl')
viz.link(tracker, hand)

#turn off mouse navigation
viz.mouse(viz.OFF)

#Add the object that the marker will grab
ball = viz.add( 'ball.wrl' )

ball.translate( 0.5, 1.5, 3 )
table=viz.add('table.wrl')
link = None
#Grab or let go of the ball

def toggleLink():
	global link
	if link:
		#If link exits, stop grabbing
		link.remove()
		link = None
         elif vizmat.Distance(hand.getPosition(), ball.getPosition()) < .5:
		vizact.onpick(ball,toggleLink)

now i want to move the ball and the table seperately. now could you please tell me how to make the changes.
Reply With Quote