Thread: User-Interface
View Single Post
Old 02-14-2005, 05:12 PM
farshizzo farshizzo is offline
WorldViz Team Member
Join Date: Mar 2003
Posts: 2,849
Make sure you are using Vizard 2.5

I've included a sample script. It adds a quad to the lower left of the SCREEN and a quad to the center of the WORLD. Clicking the left mouse button will perform a pick on the WORLD and clicking the right mouse button will perform a pick on the SCREEN. When the screen quad is picked it will print out "Picked screen quad". When the world quad is picked it will print out "Picked world quad". If it doesn't work can you check if any errors are being printed out.
import viz

ScreenQuad = viz.add(viz.TEXQUAD,viz.SCREEN)

WorldQuad = viz.add(viz.TEXQUAD)


def onmousedown(button):
	object = 0
	if button == viz.MOUSEBUTTON_LEFT:
		object = viz.pick()
	elif button == viz.MOUSEBUTTON_RIGHT:
		object = viz.pick(0,viz.SCREEN)
	if object and object.valid():
		if object == ScreenQuad:
			print 'Picked screen quad'
		elif object == WorldQuad:
			print 'Picked world quad'

Reply With Quote