home *** CD-ROM | disk | FTP | other *** search
/ Maximum 3D 3 / m3d-p3.iso / 3DS_MAX / 3DSMAX.2_0 / SCRIPTS / CONEPTRN.MS < prev    next >
Text File  |  1997-10-19  |  1KB  |  38 lines

  1. -- Created by: Ravi Karra [ravi.karra@ktx.com]
  2. -- This script creates and moves a set of spheres on a helical path
  3. -- Each sphere accelerates with different magnitudes as they move
  4.      
  5. resetMaxFile #noPrompt
  6. r1 = 0         --Base radius of helical path 
  7. r2 = 50.0          --Radius at the top
  8. H  = 100.0         --Height of the helix
  9. r  = 2.0        --Radius of sphere
  10. tr = 5.0        --Turns
  11. n  = 100        --Num of objects
  12. doMats = false     --Make this true to assign random materials to the objects
  13. posO = [0, 0, 0]    --Starting position of the objects
  14. b = #()
  15.  
  16. n_mats = currentMaterialLibrary.count
  17. for i = 1 to n do
  18. (
  19.     b[i] = sphere radius:r pos:posO mapcoords:true
  20.     if (doMats) then b[i].mat = currentMaterialLibrary[random 1 n_mats]
  21. )
  22. hlx = helix radius1:r1 radius2:(2*r2) height:(2*H) turns:(2*tr) direction:1
  23. progressStart "Creating the Objects"
  24. animate on for t in 0 to 100 do at time t
  25. (
  26.     if (getProgressCancel())==true then exit
  27.     progressUpdate t
  28.     for i = 1 to n do
  29.     (
  30.         local fac = (1 + i*1.0/n)
  31.         local ang = t * 3.6*tr*fac
  32.         local rX = r1+((r2 - r1)*t*fac/100) --R at any point X
  33.         b[i].position = posO + [rX * cos(ang), rX * sin(ang), H*t*fac/100 ]                
  34.     )    
  35. )
  36. progressEnd ()
  37. max zoomext sel all
  38. max time play