View Single Post
  #2  
Old 04-08-2015, 06:03 AM
mape2k mape2k is offline
Member
 
Join Date: Mar 2013
Posts: 60
The problems you have originate from the last bits of your code:

Code:
def changeScene(scene):
	viz.MainWindow.setScene(scene)
	if scene == viz.Scene2:
		viz.MainView.setPosition([0,1.8,0])
		viz.MainView.setEuler([90,0,0])
	
manager.onEnter(None, changeScene)
In the last line, you tell Vizard to call the function changeScene() whenever the sensor is entered. The argument that gets passed to that function by default is the sensor that was activated. So your variable <scene> will be a proximity sensor => this will create an error when trying to change the scene to a sensor.

To fix this, you need to pass more arguments to the function changeScene, e.g.:

Code:
def changeScene(sensor,scene):

	viz.MainWindow.setScene(scene)
	if scene == viz.Scene2:
		viz.MainView.setPosition([0,1.8,0])
		viz.MainView.setEuler([90,0,0])
	
manager.onEnter(None, changeScene, desiredScene)
in which <desiredScene> is the variable to the scene you wish to change to.
Reply With Quote