Thread: wiimote
View Single Post
  #2  
Old 01-27-2009, 09:42 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
try using the viz.screentoworld function to get a line that you can use to call viz.intersect. This code should let you know if the pointer is in line with an object

Code:
def FireLine():
	
	line = viz.screentoworld(pointer.getPosition())
	dir = viz.Vector(line.dir)
	dir.setLength(200)
	begin = line.begin
	end = line.begin + dir
	info = viz.intersect(begin,end)
	if info.valid:
		print "intersected"

vizact.onsensordown(wiimote,wii.BUTTON_B,FireLine)
Reply With Quote