ScriptSpot is a diverse online community of artists and developers who come together to find and share scripts that empower their creativity with 3ds Max. Our users come from all parts of the world and work in everything from visual effects to gaming, architecture, students or hobbyists.
Submitted by JokerMartini on Mon, 2011-03-07 11:18
So I have a loop function that runs 4 times. Each time it runs it creates a box incrementally moving it along the x axis. How could I make the loop link to the box previously created in the loop?
for i = 0 to 5 do --repeat five times, for each iteration do:
(
box_copy = copy mybox --create a copy of the original box
box_copy.pos = [i*20, 0, 0] --place it i*20 units along x
if parentBone != undefined then
(
print "Link"
box_copy.parent = parentBone
)
parentBone = box_copy
)--end of the for loop
)
Comments
Answer!
(
local parentBone = undefined
mybox = box length:10 width:10 height:10 wirecolor:blue --new box
for i = 0 to 5 do --repeat five times, for each iteration do:
(
box_copy = copy mybox --create a copy of the original box
box_copy.pos = [i*20, 0, 0] --place it i*20 units along x
if parentBone != undefined then
(
print "Link"
box_copy.parent = parentBone
)
parentBone = box_copy
)--end of the for loop
)
John Martini
Digital Artist
http://www.JokerMartini.com (new site)