WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Switching between input devices setup in vizconnect and not using vizconnect (https://forum.worldviz.com/showthread.php?t=5260)

JB_HP_Viz 01-14-2015 11:22 AM

Switching between input devices setup in vizconnect and not using vizconnect
 
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
Code:

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,helicopterTransport)
vizact.onkeydown('2',display.setParent,fly_mouseKeyTracker)
vizact.onkeydown('3',display.setParent,walk_mouseKeyTracker)
vizact.onkeydown('4',display.setParent,keyTracker)
vizact.onkeydown('5',display.setParent,flyingTransport)
vizact.onkeydown('6',display.setParent,wandmagiccarpetTransport)

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:

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)



All times are GMT -7. The time now is 11:36 PM.

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