View Single Post
  #6  
Old 11-02-2016, 01:33 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
Here's an example that performs the pick command on the center of the window:

Code:
import viz
import vizact

viz.go()

viz.clearcolor(viz.SLATE)

soccerball = viz.addChild('soccerball.osgb',pos=[-1,1.8,2])
basketball = viz.addChild('basketball.osgb',pos=[0,1.8,2])
volleyball = viz.addChild('volleyball.osgb',pos=[1,1.8,2])

crosshair = viz.addTexQuad(parent=viz.SCREEN,texture=viz.add('crosshair.png'),pos=[0.5,0.5,0])

def pickObject():
	node = viz.pick(pos=[0.5,0.5])
	if node == soccerball:
		print 'soccerball'
	elif node == basketball:
		print 'basketball'
	elif node == volleyball:
		print 'volleyball'
	else:
		print 'none'
	
vizact.onupdate(0,pickObject)
Also, the gazetime example script in this thread maybe helpful.
Reply With Quote