View Single Post
  #4  
Old 02-12-2010, 10:36 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
Thanks for the note the about the incorrect argument name. If you notice something like that again, please mention it and we'll make the correction.

Here's an example that uses all = True with viz.phys.intersectLine() to turn intersected nodes.
Code:
import viz
viz.go()

box = viz.add('box.wrl', pos = [0,1,5])
shape1 = box.collideBox()
box2 = viz.add('box.wrl', pos = [0,1,7])
shape2 = box2.collideBox()

def FireLine():
	line = viz.MainWindow.screenToWorld(viz.mouse.getPosition()+[0])
	dir = viz.Vector(line.dir)
	dir.setLength(200)
	begin = line.begin
	end = line.begin + dir
	info = viz.phys.intersectLine(begin,end, all = True)
	for i in info:
		i.object.color(viz.BLUE)
		
vizact.onmousedown(viz.MOUSEBUTTON_LEFT,FireLine)

viz.mouse(viz.OFF)

Can you post an example where it did notwork for you?
Reply With Quote