![]() |
|
#2
|
|||
|
|||
|
It looks for two lists:
lineBegin [x,y,z] position of begin point of intersection line. lineEnd [x,y,z] position of end point of intersection line. In the following example code a ball is placed at the intersection point on the quad in the direction the user is looking: Code:
import viz
import vizact
import vizmat
viz.go()
dojo = viz.addChild('dojo.osgb')
import vizshape
quad = vizshape.addQuad(pos=[0,1.5,2],color=viz.SKYBLUE)
ball = vizshape.addSphere(radius=0.02,color=viz.ORANGE)
def showIntersection():
lineBegin = viz.MainView.getPosition()
vector = viz.MainView.getMatrix().getForward()
lineEnd = vizmat.MoveAlongVector(lineBegin,vector,10)
i = quad.intersect(lineBegin,lineEnd)
point = i.point
ball.setPosition(point)
vizact.onkeydown(' ',showIntersection)
|
| Tags |
| intersect, plane |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Question about using function | hankiwan | Vizard | 1 | 02-15-2010 11:50 AM |
| return variable from keypress function | starbug | Vizard | 2 | 01-07-2010 12:14 PM |
| About intersect function | omidbrb | Vizard | 5 | 02-24-2009 03:57 AM |
| Do you know how to send a value for 'pool' to the onActionEnd function? | ghazanfar | Vizard | 1 | 03-22-2007 11:25 AM |