WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 01-14-2015, 12:22 PM
JB_HP_Viz JB_HP_Viz is offline
Member
 
Join Date: Jun 2014
Posts: 31
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
Reply With Quote
  #2  
Old 01-20-2015, 06:19 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
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
Reply


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


All times are GMT -7. The time now is 04:15 AM.


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