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

  1. --===============    Creates a pattern of boxes    --==================
  2. -- Created by: Ravi Karra [ravi.karra@ktx.com]
  3.  
  4. resetMaxFile #noPrompt
  5. a = #()
  6. L = 20; W = 30; H =1.0; -- Length, Width & Heigth of the boards
  7. curX = curZ = 0;
  8. numBoards = 10
  9. angI = 45         -- Initial angle between the horizontal plane and the diagonal
  10. angF = 0;          -- Final angle between the horizontal plane and the diagonal
  11. angC ;            -- This is the difference in angles (angF - angI) 
  12. for i = 1 to numBoards do
  13. (
  14.     local b
  15.     if (mod i 2)== 0 then --Creates the horizontal boards
  16.     (
  17.         curZ += W/2 - H/2
  18.         a[i] = box length:L width:W height:H pos:[curX,0, curZ]
  19.         -- a[i+1].pivot = [curX-W/2,0, curZ-w/2]             
  20.     )
  21.     else --Creates the vertical boards
  22.     (
  23.         curX += W/2 - H/2 
  24.         a[i] = box length:L width:H height:W pos:[curX,0, curZ]
  25.         a[i].pivot = [curX,0, curZ+w/2]
  26.     )
  27. )
  28.  
  29. angF = 15; --Setting the final angle 
  30. angC = angF - angI
  31. del  = (sqrt(2) * cos(angF)-1)*W/2
  32. --if angF > angI then del = (-del));
  33. delX = del * cos(angI)
  34. delZ = del * sin(angI)
  35. fac  =sqrt(2)
  36. animate on 
  37. (
  38.     at time 0         
  39.     at time 50 (
  40.                     for j in 1 to numBoards do 
  41.                     ( 
  42.                         if (mod j 2)== 0 then
  43.                         (  
  44.                             if j < (numBoards/2) then
  45.                             (
  46.                                 mov = (numBoards/2 - j)/2 + 1
  47.                                 chnX = fac*(-delX * mov)
  48.                                 chnZ = fac*(-delZ * mov) 
  49.                                 move a[j] [    chnX , 0, chnZ]
  50.                                 move a[j-1] [chnX  , 0, chnZ ]
  51.                                 --format "j: %\tmov: %\tchnX %\tchnZ: %\n" j mov chnX chnZ 
  52.  
  53.                             )
  54.                             if j > (numBoards/2 + 1) then
  55.                             (
  56.                                 mov = (j - numBoards/2 )/2
  57.                                 chnX = fac*(delX * mov)
  58.                                 chnZ = fac*(delZ * mov) 
  59.                                 move a[j] [chnX, 0, chnZ]
  60.                                 move a[j-1] [chnX, 0, chnZ]
  61.                                 --format "j: %\tmov: %\tchnX %\tchnZ: %\n" j mov chnX chnZ
  62.                             )
  63.                              rotate a[j] angC [0,1,0]                        
  64.                         ) 
  65.                         else 
  66.                             rotate a[j] -angC [0,1,0]
  67.                         --print a[j].pos 
  68.                     )            
  69.                 )
  70.     at time 100 (
  71.                     for j in 1 to numBoards do 
  72.                     ( 
  73.                         if (mod j 2)== 0 then
  74.                         ( 
  75.                             if j < (numBoards/2) then
  76.                             (
  77.                                 mov = (numBoards/2 - j)/2 + 1
  78.                                 chnX = fac*(delX * mov)
  79.                                 chnZ = fac*(delZ * mov) 
  80.                                 move a[j] [    chnX , 0, chnZ]
  81.                                 move a[j-1] [chnX  , 0, chnZ ]
  82.                                 --format "j: %\tmov: %\tchnX %\tchnZ: %\n" j mov chnX chnZ
  83.                             )
  84.                             if j > (numBoards/2 + 1) then
  85.                             (
  86.                                 mov = (j-numBoards/2 )/2
  87.                                 chnX = fac*(-delX * mov)
  88.                                 chnZ = fac*(-delZ * mov) 
  89.                                 move a[j] [chnX, 0, chnZ]
  90.                                 move a[j-1] [chnX, 0, chnZ]
  91.                                 --format "j: %\tmov: %\tchnX %\tchnZ: %\n" j mov chnX chnZ                             
  92.                             )
  93.                             rotate a[j] -angC [0,1,0]                         
  94.                         )
  95.                         else 
  96.                             rotate a[j] angC [0,1,0]
  97.                     )
  98.                 )
  99. )          
  100.  
  101.  max tool zoomextents all
  102.  max time play