WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   sequence (https://forum.worldviz.com/showthread.php?t=1245)

jaclyn.bill 10-16-2007 08:08 AM

sequence
 
hi,

I'm new to vizard and need to solve what is possibly a silly problem.

I'm hoping to create stimuli for an experiement in which a series of ball travel towards the viewer, disappear, reappear at the beginning and travel towards the viewer again- multiple times with varying speed and distance etc.

The code below carries this out fine. I'm running into trouble with my "for" function however. I would like it to run for x=1, m=.5 then x=-1, m=-.5 etc. (in the example below) so that the for functions run parallel. However, as it stands it runs 2 x=1 (for m= .5 then -.5) then 2 x = -1 (for m=.5 then m = -.5) etc. Is there any way to get these for sequences to run parallel so that the stimuli don't get presented in blocks?

I would appreciate any comments on this.

Thank you.

Jaclyn.

mport viz
import vizact
import vizmat
from random import random
import time
import math

viz.go()

gball = viz.add('golfball.wrl')

Start_Z = 100.0
Stop_Z = 10.0
s = 100.0
d = Start_Z-Stop_Z
t = d/s
Spin = 150.0
Angle = Spin*t


viz.move(0,0,0)## sets viewpoint at z meters away
#gball.setPosition (0,0,0) ####sets object position if do not want the Start_Z
viz.eyeheight(0) ####sets eye height, default is 1.82 (6ft)

gball.translate(0,0,0)####sets object position

for x in [1, -1, 0]:

for m in [.5, -.5, -.2]:



moveForward=vizact.goto(x,0,Stop_Z,.8+m,viz.TIME)
#moveForward=vizact.goto(x,0,Stop_Z,.8+m,viz.SPEED )
moveStart=vizact.goto(0,0,Start_Z,0.01,viz.TIME)
moveOut=vizact.goto(0,0,-1000,0.001,viz.TIME)
wait1 = vizact.waittime(0.5)
wait2 = vizact.waittime(5)
motionseq=vizact.sequence(moveStart,wait1,moveForw ard,moveOut,wait2,moveStart,wait1)
gball.add(motionseq)

farshizzo 10-16-2007 02:28 PM

Can you please repost your code using the [code][/code] tags. It preserves the formatting and makes the code easier to understand.

jaclyn.bill 10-17-2007 01:28 AM

repost
 
sorry about that, here's the code again


Code:

#### x left and right stop position
##### d = distance
##### s = speed
#### t = time

#### m randomisation factors for time


import viz
import vizact
import vizmat
from random import random
import time
import math

viz.go()


gball = viz.add('footy.ac')




Start_Z = 100
Stop_Z = 10.0
s = 100.0
d = Start_Z-Stop_Z
t = d/s
Spin = 150.0
Angle = Spin*t


viz.move(0,0,0)## sets viewpoint at z meters away
#gball.setPosition (0,0,0) ####sets object position if do not want the Start_Z
viz.eyeheight(0)

#gball.translate(0,0,0)####sets object position
 
for x in [1, -1, 0]: #######will be -4 - 4 in .2 increments

        for m in [.5, -.5, -2]:
               


                moveForward=vizact.goto(x,-10,Stop_Z,.8+m,viz.TIME)
                moveStart=vizact.goto(0,0,Start_Z,0.01,viz.TIME)
                moveOut=vizact.goto(0,0,-1000,0.001,viz.TIME)
                wait1 = vizact.waittime(0.5)
                wait2 = vizact.waittime(5)
                motionseq=vizact.sequence(moveStart,wait1,moveForward,moveOut,wait2,moveStart,wait1)
                gball.add(motionseq)


jaclyn.bill 10-18-2007 08:19 AM

done
 
Done, I was being a bit stupid!


All times are GMT -7. The time now is 06:53 PM.

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