View Full Version : Changing scenes with proximity sensors
BSUGeek
03-21-2015, 11:59 AM
Hi is there a way to change your viewpoint position when changing from one scene to another? also I'm trying to change a scene once the viewpoint goes into a proximity sensor. How would I go about doing that?
You could create a function that sets a new viewpoint position when the scene changes:
'''
Press 1 for scene1
Press 2 for scene2
'''
import viz
import vizact
import vizinfo
vizinfo.InfoPanel()
viz.go()
viz.addChild('piazza.osgb')
viz.addChild('dojo.osgb',scene=viz.Scene2)
def changeScene(scene):
viz.MainWindow.setScene(scene)
if scene == viz.Scene1:
viz.MainView.setPosition([0,1.8,0])
else:
viz.MainView.setPosition([0,4,0])
vizact.onkeydown('1',changeScene,viz.Scene1)
vizact.onkeydown('2',changeScene,viz.Scene2)
If you want to change the scene when the viewpoint enters a proximity sensor, you'll need to register a callback function for the proximity enter event (http://docs.worldviz.com/vizard/#vizproximity_events.htm).
vBulletin® v3.8.7, Copyright ©2000-2024, vBulletin Solutions, Inc.