PDA

View Full Version : pick intersect point in object coordinates


blindberg
01-07-2016, 10:12 AM
Is there a way to get the intersect point when picking using
viz.pick(info=True)
in the local coordinates of the object being picked?

Jeff
01-12-2016, 02:51 AM
The command returns a point in global coordinates but you could convert (http://forum.worldviz.com/showthread.php?t=2032) this into local coordinates of the object that is picked:

import viz
import vizact
viz.go()

viz.addChild('piazza.osgb')
ball = viz.addChild('beachball.osgb',pos=[0,1.5,3])

def updatePick():
info = viz.pick(info=True)
if info.object == ball:
print 'global',info.point
helper = viz.addGroup(parent=ball)
helper.setPosition(info.point, viz.ABS_GLOBAL)
print 'local',helper.getPosition() #mode defaults to viz.ABS_PARENT

vizact.ontimer(1,updatePick)