#1
|
|||
|
|||
removing multiple objects
Hello,
I cannot figure out how to remove or delete multiple objects that have been created this way: Code:
def balls(): ball = ballOriginal.copy() ball.scale(.5,.5,.5) ball.collideSphere() ball.setPosition([0,20,0]) vizact.ontimer2(0,200,balls) Thanks |
#2
|
|||
|
|||
You should save each object you create into a global list. Then you can periodically go through the list and remove the objects.
|
#3
|
|||
|
|||
Is there a good example of this to follow?
|
#4
|
|||
|
|||
I'm not sure there is an example that does exactly what you want, but the Duck Court example script that comes with Vizard shows how to save objects into a global list so they can be referenced later.
|
#5
|
|||
|
|||
Code:
ballList = [] def balls(): ball = ballOriginal.copy() ball.scale(.5,.5,.5) ball.collideSphere() ball.setPosition([0,20,0]) ballList.append(ball) vizact.ontimer2(0,200,balls) |
#6
|
|||
|
|||
I'm not sure if I understand exactly what you want to do, but if you first make the global list and then want to take all the balls out of it, you could:
Code:
for row in range(len(ballList)): ballList[row].remove() Or, you could just erase your list by re-initializing it (I think): Code:
ballList = [] |
#7
|
|||
|
|||
Ok I will give that a try later... thanks for the feedback
|
#8
|
|||
|
|||
Great I think it worked.
|
Thread Tools | |
Display Modes | Rate This Thread |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Semi-circle array containing target and distractor objects | ptjt255 | Vizard | 3 | 08-04-2009 04:09 AM |
multiple objects | durf | Vizard | 1 | 04-10-2009 02:42 PM |
Moving multiple objects with ppt | durf | Vizard | 1 | 02-10-2009 04:03 PM |
Problems with making multiple objects from one .wrl? | mjabon | Vizard | 3 | 07-10-2007 02:23 PM |
Could not find plugin to load objects... | halley | Vizard | 1 | 05-30-2006 12:01 PM |