#1
|
|||
|
|||
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) ... Code:
viztask.addAction(Object1, TempActionSpinObject1) yield viztask.addAction(Object2, TempActionSpinObject2) Code:
viztask.addAction(Object1, TempActionSpinObject1, pool = 0) yield viztask.addAction(Object2, TempActionSpinObject2, pool = 1) Greetings Amir |
#2
|
|||
|
|||
You can use viztask.waitAll to wait for a specified set of actions to complete. Here is an example:
Code:
import viz import vizact import viztask viz.go() Object1 = viz.add('beachball.osgb',pos=(-1,2,5)) Object2 = viz.add('soccerball.osgb',pos=(1,2,5)) def MainTask(): yield viztask.waitKeyDown(' ') spin1 = vizact.spinTo(euler=[90,0,0], speed=45) spin2 = vizact.spinTo(euler=[0,90,0], speed=45) waitSpin1 = viztask.waitTask( viztask.addAction(Object1, spin1) ) waitSpin2 = viztask.waitTask( viztask.addAction(Object2, spin2) ) yield viztask.waitAll( [waitSpin1, waitSpin2] ) print 'finished' viztask.schedule( MainTask() ) |
#3
|
|||
|
|||
Hi,
Very many thanks for your detailed reply. Very helpful. Greetings Amir |
Thread Tools | |
Display Modes | Rate This Thread |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Transparency on multiple objects | NASA GRC | Vizard | 0 | 03-15-2010 01:46 PM |
removing multiple objects | durf | Vizard | 7 | 08-05-2009 10:15 AM |
run multiple actions simultaneously | durf | Vizard | 1 | 05-08-2009 01:17 PM |
multiple objects | durf | Vizard | 1 | 04-10-2009 02:42 PM |
Problems with making multiple objects from one .wrl? | mjabon | Vizard | 3 | 07-10-2007 02:23 PM |