WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Changing scenes with proximity sensors (https://forum.worldviz.com/showthread.php?t=5317)

BSUGeek 03-21-2015 11:59 AM

Changing scenes with proximity sensors
 
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?

Jeff 03-24-2015 01:10 AM

You could create a function that sets a new viewpoint position when the scene changes:
Code:

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


All times are GMT -7. The time now is 02:13 PM.

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