View Single Post
  #2  
Old 05-10-2009, 05:14 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
You could randomly select a scene using the random module to generate a random integer and then set the scene to that number.
Code:
import viz
import random
viz.go()

#add three objects to three different scenes
duck = viz.add('duck.wrl',scene = 1)
wheelbarrow = viz.add('wheelbarrow.ive',scene=2)
wheelbarrow = viz.add('ball.wrl',scene=3)

viz.MainView.move(0,-1,-7)

def changeScene():
	num = random.randint(1,3)
	viz.scene(num)

vizact.ontimer(2, changeScene)
To get an objects position use
Code:
object.getPosition()
That will return a list with x,y,z position of the object.
Reply With Quote