PDA

View Full Version : Switching between input devices setup in vizconnect and not using vizconnect


JB_HP_Viz
01-14-2015, 11:22 AM
How do you switch between multiple input devices setup in Vizconnect and not setup in Vizconnect to control the display (viewpoint). I know how to switch between different input devices setup in Vizconnect. But is there way to setup so user can be able to switch between the input devices setup in vizconnect and also be able to switch to a having something like a vizhtml page as the input device to move viewpoint around in the virtual world. Like the htmlWebSocket.py found in Vizard5->examples->html and how you can click on vizhtml page and move the viewpoint around.

Example of code using for switching between input devices setup in vizconnect

keyTracker = vizconnect.getTracker('keyboard')
fly_mouseKeyTracker = vizconnect.getTracker('mouse_and_keyboard_flying')
walk_mouseKeyTracker = vizconnect.getTracker('mouse_and_keyboard_walking' )
helicopterTransport = vizconnect.getTransport('helicopter')
flyingTransport = vizconnect.getTransport('flying')
wandmagiccarpetTransport = vizconnect.getTransport('wandmagiccarpet')

display = vizconnect.getDisplay()

vizact.onkeydown('1',display.setParent,helicopterT ransport)
vizact.onkeydown('2',display.setParent,fly_mouseKe yTracker)
vizact.onkeydown('3',display.setParent,walk_mouseK eyTracker)
vizact.onkeydown('4',display.setParent,keyTracker)
vizact.onkeydown('5',display.setParent,flyingTrans port)
vizact.onkeydown('6',display.setParent,wandmagicca rpetTransport)


Thank you

John

Jeff
01-20-2015, 05:19 AM
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:

'''
'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)