|05 May 2013|
Recursive script help needed.
I'm new to the forums so bare with me please. We are doing this recursive script and it is just hard to find information that we need, we have gotten this far and can't even delete the parents with leaving the children only..Later on we will want the recursion to happen in one place more than the other by selecting a point, and or placing the recursion on a certain plane or shape..
So my questions are:
1. How do you find the needed info for the syntax? Do you know or have any recursion tutorials?
2. How do you delete the parents each time you make the new children?
3. Is there a way in doing this script more efficiently? (I have a feeling its extremely inefficient)
4. how do you do recursion in one place more than the other by placing a point?
5. how do you place it on a plane then?
Basically I want to learn the basics of maxscript, and I will be browsing throught this forum and other ones at the same time waiting for responses here (because of the lack of time we have). Thank you for you patience and help.
Here is the script (couldn't find a way to attach the file):
myLevel = 2
radius = 20
a = 180
global triangleRoot = NGon radius:radius nsides:3 scribe:1
fn createChildren parentTriangle currentLevel =
if currentLevel < 6 then
child01 = copy parentTriangle
child01.radius = (parentTriangle.radius/2)
aRotation = eulerAngles 0 0 a
rotate child01 aRotation
(child01.parent = parentTriangle)
child02 = copy parentTriangle
child02.radius = (parentTriangle.radius/2)
in coordsys parentTriangle move child02 [(parentTriangle.radius/2), 0, 0]
(child02.parent = parentTriangle)
child03 = copy parentTriangle
child03.radius = (parentTriangle.radius/2)
in coordsys parentTriangle move child03 [-(parentTriangle.radius/4), ((sqrt 3)/4)*(parentTriangle.radius)+(1/6)*(parentTriangle.radius) , 0]
(child03.parent = parentTriangle)
child04 = copy parentTriangle
child04.radius = (parentTriangle.radius/2)
in coordsys parentTriangle move child04 [-(parentTriangle.radius/4), -((sqrt 3)/4)*(parentTriangle.radius)+(1/6)*(parentTriangle.radius), 0]
(child04.parent = parentTriangle)
currentLevel = currentLevel +1
for i =1 to parentTriangle.children.count by 1 do
createChildren parentTriangle.children[i] currentLevel
createChildren triangleRoot myLevel
|05 May 2013|
Thread automatically closed
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
|Thread Closed share thread|