View Single Post
  #1  
Old 07-09-2007, 10:05 PM
mjabon mjabon is offline
Member
 
Join Date: Jul 2007
Posts: 63
Problems with making multiple objects from one .wrl?

Hello. I am having problems when I use a for loop to create a bunch of objects from one wrl. I want them all to be draggable by the hd. This is what I write:

for i in range(0,num):
rnumx = random.random()
rnumz = random.random()
#print rnum
screw = viz.add(SCREW_FILE)
tex = viz.add(SCREW_TEXTURE)
screw.texture(tex)
screw.scale(scale,SCREW_LENGTH,scale)
screw.rotate(1,0,0,90)
screw.translate(0,0,0)
screw.translate(x + r*rnumx,y + rnumz,z)
allObjects.append(screw)
screws.append(screw)
screw.visible(1)
hd.add(screw)
screw.stiffness(1.0)

But I can only pick up the first one.
Reply With Quote