Thread: Movement Question View Single Post
#1
10-18-2007, 08:37 AM
 Elittdogg Member Join Date: Aug 2007 Posts: 77
Movement Question

So I'm trying to move an object (a picture) forward and backward a certain distance for a certain period of time. What I can't get it to do in this case is to move some fixed amount (e.g. 2 m) for X amount of seconds. In this example in the following code, I need to it to be able to go 2 m forward for .01 s then 2 m backward for .01 and do that sequence for 1 min (which is why I have "60/freq." Because I thought that would give me how many time .01 s went into 60 s. After a minute I want it to change to move 2 m forward for 2 seconds and 2 m backward for 2 seconds and to do that "60/freq" times (i.e. 30 times). ETC ETC ETC. Then I have the whole sequence looping 5 times (so it'll go through (.01, 2, .03, .0, .05, .06) a total of 5 times).

def WriteFlag():

movefreq = [.01, 2, .03, .04, .05, .06]
sequences = []
for freq in movefreq:
MoveRoom = vizact.sequence(vizact.move(0,0,2,freq), vizact.move(0,0,-2,freq), 60/freq)
sequences.append(MoveRoom)
sequences.append( vizact.call( WriteFlag ) )
MovingRoom = vizact.sequence(sequences, 5)

Here's my problem. I can't get it to move X distance for Y seconds. If I switch it so the code looks like "vizact.move(0,0,freq,2). Then it'll move the specified distance in 2 seconds. But I can't get it to do the other thing that I want (above). I was thinking that maybe I'm specifying it to move for too short of an amount of time????? Or maybe I need it to move too far too quickly? I mean, asking something to move 2m in .01 seconds is kind of quick. Is there some threshold that I need to be above?

Also I was wondering how I could make them both vairable (i.e. how far the picture moves and for how long). I was thinking about creating two lists in that case "dist and freq" and then having something like vizact.move(0,0, dist, freq). Would that work or am I missing something?

Last edited by Elittdogg; 10-18-2007 at 08:46 AM.