Can i compound this to one building?

15 views
Skip to first unread message

Dennisans

unread,
Oct 19, 2022, 3:52:05 AM10/19/22
to Glowscript Users
a=1
for i in range(40):
    b=i/8
    box(width=10-b,length=6, height=1, pos=vec(0,a-30,b/2))
    a=a+1


So I made this shape, and i gotta make it to one building. How can I use compound to this shape?

Bruce Sherwood

unread,
Oct 19, 2022, 12:21:47 PM10/19/22
to Glowscript Users
The key to making a compound object is to put the individual objects into a list, then give that list to the compound function:

boxes = []

for i in range(40):
    b=i/8
    boxes.append(  box(width=10-b,length=6, height=1, pos=vec(0,i+1-30,b/2))  )
building = compound(boxes)

Note that you don't need to create a variable a that starts at 1; the quantity i+1 is the same as your a.

Bruce
Reply all
Reply to author
Forward
0 new messages