View Single Post
  #1  
Old 07-18-2013, 10:37 PM
javadi javadi is offline
Member
 
Join Date: Mar 2013
Location: London
Posts: 33
Simultaneous Actions on Multiple Objects

Hi,

I am wondering how I can run actions on multiple objects at the same time. It is a very basic task, but I cannot find any solution to it. The structure of my code is as follows: I have a scheduler that calls function MainProcedure. There I want to for example spin two objects ('Object1' & 'Object2') simultaneously. A part of my code goes below

Code:
if __name__ == "__main__":
	...
	viztask.schedule(MainProcedure())
	...

def MainProcedure():
	...

	TempActionSpinObject1 = vizact.spinTo(euler = [90, 0, 0], speed = SpeedTurn)
	TempActionSpinObject2 = vizact.spinTo(euler = [0, 90, 0], speed = SpeedTurn)

	yield viztask.addAction(Object1, TempActionSpinObject1)
	yield viztask.addAction(Object2, TempActionSpinObject2)

	...
The code as it stands now, first spins the first object and then the second one. I tried the following code (removing 'yield') to test whether the objects spins together, but it turned out that the first objects doesn't spin at all, but the second object spins fine.

Code:
	viztask.addAction(Object1, TempActionSpinObject1)
	yield viztask.addAction(Object2, TempActionSpinObject2)
I thought perhaps it has something to do with 'pool' numbers. I thought perhaps the 2nd action overwrites the first one, if the pool numbers are both set to default (zero). so, I tried the following code, but again no luck.

Code:
	viztask.addAction(Object1, TempActionSpinObject1, pool = 0)
	yield viztask.addAction(Object2, TempActionSpinObject2, pool = 1)
I know about vizact.sequence and vizact.parallel. As far as I understand they act on one object. Any idea how to solve this problem? Very many thanks.

Greetings
Amir
Reply With Quote