Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- delete objects
- function tree currentHeight maxHeight parentbox:undefined branchingChance:0.13 =
- (
- firstbox = undefined
- for i = currentHeight to maxHeight do
- (
- newbox = Box length: 5 width: 5 height: 5
- if firstbox == undefined then
- (
- firstbox = newbox
- )
- if parentbox != undefined then
- (
- newbox.parent = parentbox
- /*
- [in] coordsys parent
- Use the object's parent's coordinate system
- https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2015/ENU/MAXScript-Help/files/GUID-6C7219CF-B9B7-4B18-A846-5522A9D970F3-htm.html
- */
- in coordsys parent newbox.scale = [0.95, 0.95, 0.95]
- in coordsys parent newbox.pos = [0, 0, 6]
- rotX = random -10.0 10.0
- rotY = random -10.0 10.0
- rotZ = random -10.0 10.0
- in coordsys parent rotate newbox (eulerAngles rotX rotY rotZ)
- branchRoll = random 0.0 1.0
- if branchRoll <= branchingChance then
- (
- branchbox = tree i maxHeight parentbox:newbox
- leafprism = prism side1length: 2 side2length: 2 side3length: 3 height: 0.1
- (
- in coordsys branchbox leafprism.pos = [0,0,1]
- )
- rotbranchX = random -45.0 45.0
- rotbranchY = random -45.0 45.0
- rotbranchZ = random -180.0 180.0
- about newbox rotate branchbox (eulerAngles rotbranchX rotbranchY rotbranchZ)
- )
- )
- parentbox = newbox
- )
- firstbox
- )
- tree 0 20 branchingChance:0.3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement