WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   displaying random scenes etc (https://forum.worldviz.com/showthread.php?t=2009)

cl113 05-07-2009 03:03 PM

displaying random scenes etc
 
i am a beginner and i am terrible at programming and am quite confused.

1. is there any way, after creating multiple scenes, that one can randomly select which scene to display using vizact.choice or something else?

2. does vizact.choice randomly choose from a list and then stop when all the list items have been chosen, or does it continue to choose from the list?

3. also, is there a specific command that allows you to reflect an object's position about a specific axis?

the online reference is not helping and any help would be much appreciated!!!!!!!!

Jeff 05-10-2009 05:14 PM

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.


All times are GMT -7. The time now is 03:34 PM.

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