WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 05-08-2012, 12:26 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
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)
Reply With Quote
 

Tags
intersect, plane


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


All times are GMT -7. The time now is 05:09 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC