Chih Lun's profile太陽咩咩的網誌PhotosBlogLists Tools Help

Blog


    November 29

    [MaxScript]2D遊戲用--八方向算圖Script

    其實這是為了再現Snake大之前寫過的一個方便工具,把他寫成8.0以上也可以用的
    ,這個Script多虧了位於上海的海諾老師的幫助,才能這麼快就寫好(如果沒有他提示,我現在可能還卡死
    在算圖輸出那個指令裡面...orz)
    海諾老師的網站:  http://66.29.111.56/bbs/index.php  (八方媒體,專門的Max腳本開發)
     
    原代碼:

    rollout OctalRendeRoll "OctalRender" width:162 height:277
    (
     global Picked_CamObj
     global Camarray = #()
     
     fn filt_cam obj=superclassof obj==camera
     pickbutton btn_Cam "SelectCamera" width:138 height:32 filter:filt_cam 
     edittext edt1 "" width:116 height:21 across:2
     button btn_save_path "Dir" width:38 height:20 align:#right
     label lbl1 "FileType:" align:#left offset:[0,4] across:2
     dropdownlist lstFileType "" items:#("jpg","tif","tga","bmp") width:50 offset:[-30,0] 
     label lbl0 "Range" align:#left
     label lbl2 "From" width:30 height:15  align:#left across:4
     spinner spn_Ren_st "" width:40 height:16 range:[0,10000,0] type:#integer scale:1 align:#left
     label lbl3 "To" width:30 height:15 align:#right
     spinner spn_Ren_end "" width:40 height:16 range:[0,10000,2] type:#integer scale:1 align:#right
     label lbl4 "Every"  width:44 height:15 across:3 align:#left
     spinner spn_step "" width:40 height:16 range:[1,100,1] type:#integer scale:1 align:#left offset:[-12,0]
     label lbl5 "Frame" width:44 height:15 offset:[-18,0]
     label lbl31 "Size:" width:44 height:15 align:#left
     spinner spn_Ren_width "" width:58 height:16 range:[0,10000,640] type:#integer scale:1 align:#left across:2
     spinner spn_Ren_height "" width:58 height:16 range:[0,10000,480] type:#integer scale:1 align:#left
     button btn_Ren "Render" width:138 height:32
     
     on btn_Cam picked obj do
     (
      btn_Cam.text = obj.name
      Picked_CamObj = obj
      )--end btn_Cam picked
     on spn_Ren_st changed val do
      spn_Ren_st.value = val
     on spn_Ren_end changed val do
      spn_Ren_end.value = val
     on spn_step changed val do
      spn_step.value = val
     on spn_Ren_width changed val do
      spn_Ren_width.value = val
     on spn_Ren_width changed val do
      spn_Ren_height.value = val
     on btn_save_path pressed do
      (
       fpath=getSavepath()
       if fpath != undefined do
       edt1.text = fpath+"\\"
      )
     on btn_Ren pressed do
     (
      delete $point*
      undo off
      poWorld = point()
      Picked_CamObj.parent = poWorld
      animate on
      (
       at time 0 rotate poWorld (eulerAngles 0 0 0)
       at time 40 in coordsys local rotate poWorld (eulerAngles 0 0 180)
       at time 80 in coordsys local rotate poWorld (eulerAngles 0 0 180)
      )
      local step = 10
      Camarr = for t = 10 to 70 by step do at time t snapshot Picked_CamObj
      Camarray = $Cameras as array
      delete poWorld
      for h = 1 to Camarray.count do
       (
        
        fname=(edt1.text+(h as string)+"."+lstFileType.items[1])    
        render camera:Camarray[h] fromframe:spn_Ren_st.value toframe:spn_Ren_end.value\
        nthframe:spn_step.value outputwidth:spn_Ren_width.value outputheight:spn_Ren_height.value\
        outputfile:fname
        
       )
      deleteItem Camarray 1
      delete Camarray
     
     )--end of btn_Ren pressed
    )
    try(closeRolloutFloater OctalFloater)catch()
    OctalFloater = newRolloutFloater "OctalRender" 195 320
    addRollout OctalRendeRoll OctalFloater

    [原創]蜈蚣Rigging Demo

    遊戲用的蜈蚣怪物,很可惜不能放出原始檔
    用了FK/ SplineIK切換的方式,可以實現S型扭動前進以及甩尾巴,以及往後飛出掛掉的動作(掛掉是用Reactor的RagDoll模擬的)