#1
|
|||
|
|||
.addAction in loops
I am trying to do something relatively simple: moving an object at a variable speed. I'm doing this by chopping up the line the object is moving along into intervals, and having each interval (e.g. 1/10th of the entire movement) have a different speed of movement, such that it slows down or speeds up as it moves. This is what I have:
Code:
intervals = 10 for index in range(1, intervals): destination = (startPosition-endPosition) * (index/intervals) + endPosition speed = destination**2 movePath = vizact.goto([0, destination, 0], speed) cover.addAction(movePath) cover.addAction(vizact.spin(0,1,0,90,1)) Here's what does happen: It uses the last entry of the loop to determine the speed, moves directly to the final destination, and then spins for 10 seconds after all of the movement is complete (rather than alternating movement and spinning for 1 second). Does anyone know what I can do to fix this, or how I could even start? Last edited by tsmurphy; 08-24-2009 at 07:07 PM. Reason: to correct something obviously |
|
|