View Single Post
  #2  
Old 01-20-2015, 05:19 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,466
Here's some example code that parents the viewpoint to either a tracker defined in the configuration file or a group node defined in the script that imports the configuration:

Code:
'''
'1' to parent viewpoint to group defined in this script. Spacebar to move group.
'2' to parent viewpoint to tracker defined in config file
'''

import viz
import vizconnect
import vizact
import vizinfo

vizinfo.InfoPanel()

vizconnect.go('vizconnect_config.py')
viz.addChild('piazza.osgb')

tracker = vizconnect.getTracker()

group = vizconnect.addGroup(name='group')
groupNode3d = group.getNode3d()
groupNode3d.setPosition([0,1.8,0])
vizact.onkeydown(' ',groupNode3d.setPosition,[0,0,2],viz.REL_LOCAL)

display = vizconnect.getDisplay()
vizact.onkeydown('1',display.setParent,group)
vizact.onkeydown('2',display.setParent,tracker)
Reply With Quote