View Single Post
  #3  
Old 04-22-2016, 09:14 AM
jelly jelly is offline
Member
 
Join Date: Feb 2016
Posts: 38
Thank you very much!

It worked now, though I am not sure what did the trick! I simplified it and it now looks like this:

Code:
import viz															#Needed to generate a world.
import viztask														#Needed to control the experiment structure.

viz.mouse.setVisible(viz.OFF) 										#Stops the mouse appearing on the screen.
viz.mouse.setOverride(viz.ON)										#Stops Vizard navigation using the mouse.

viz.clearcolor(viz.BLACK)

viz.go()

#Set the start position:
startPos = [-6.4,0,-8]

### Add all the resources. ############### 

maze1 = viz.add('Objects/Maze_1.dae')
maze1.visible(viz.OFF)

#Add a sky with an environment map.
env = viz.add(viz.ENVIRONMENT_MAP,'sky.jpg')
dome = viz.add('skydome.dlc')
dome.texture(env)

view = viz.MainView 

view.eyeheight(1.4)
view.setPosition(startPos)

view.collision(viz.ON)
viz.collisionbuffer(.8)

##Animation path
pathMaze1 = viz.addAnimationPath()

#Add control points to the path, along with their time stamp.
pathMaze1.addControlPoint(2, pos=startPos,euler=(0,0,0),scale=(2,2,2))
pathMaze1.addControlPoint(4, pos=startPos,euler=(90,0,0),scale=(2,2,2))
pathMaze1.addControlPoint(6, pos=(0,0,-8),euler=(0,0,0),scale=(2,2,2))
pathMaze1.addControlPoint(8, pos=(0,0,5),euler=(0,0,0),scale=(2,2,2))

#Duation of animation
pathMaze1Duration = pathMaze1.getDuration()

def animation():

	link = viz.link(pathMaze1,view)
	pathMaze1.play()
	yield viztask.waitTime(pathMaze1Duration)
	pathMaze1.reset()


def maze1trial():
	print 'now'
	view.setPosition(startPos)
	print view.getPosition(mode = viz.ABS_PARENT)
	maze1.visible(viz.ON)
	yield animation()
	print view.getPosition(mode = viz.ABS_PARENT)
	maze1.visible(viz.OFF)


def masterFunction():	
	for x in range(4):
		yield maze1trial()
viztask.schedule(masterFunction())
Reply With Quote