An-Cadsolutions      Imgsystems

Kirjoittaja Aihe: 3dsmax: Biped to meshskeleton  (Luettu 521 kertaa)

xcx

  • Administrator
  • *****
  • Viestejä: 2302
  • Sukupuoli: Mies
    • Profiili
    • Verajankorva.com
    • Sähköposti
3dsmax: Biped to meshskeleton
« : Toukokuu 12, 2006, 12:26:09 pm »
Oikeastaan TeemuOK:n onglmaan skeletonien ajamisesta toisella skeleton tein scriptin, joka tekee Bipedista meshSkeletonin ja asettaa mesh skeletonille oikeat parentoinnit ja constraintit automaagisesti. Eli valitaan Bipedin root bone ja ajetaan scripti niin mesh skeleton liikkuu bipedin mukana. Voit tietysti myös samalla periaattella ajaa mesh skeletonilla mistä tahansa tuodusta skeletonilla, kuten esim. MB:stä.

Koodia: [Valitse]
fn myFnBipedToMesh fpBipRoot =
(
format "[DBG] Converting biped...\n"

aObjs = #()
aObjs = myFnCopyChild fpBipRoot aObjs
myFnFixParents fpBipRoot
myFnSetupConstraints fpBipRoot

select aObjs
)

fn myFnCopyChild fpObj fpObjs =
(
for i=1 to fpObj.children.count do
(
obj = fpObj.children[i]
tObj = (snapshot obj)
tObj.name = ("BipToMesh_"+obj.name)
tObj.parent = undefined
append fpObjs tObj
myFnCopyChild (obj) fpObjs
)

return fpObjs
)

fn myFnFixParents fpObj =
(
for i=1 to fpObj.children.count do
(
if (fpObj.children[i]) != undefined do
(
obj = fpObj.children[i]
tObj = getNodeByName ("BipToMesh_"+obj.name)
tObj.parent = (getNodeByName ("BipToMesh_"+obj.parent.name))

myFnFixParents obj
)
)
)

fn myFnSetupConstraints fpObj =
(
for i=1 to fpObj.children.count do
(
obj = fpObj.children[i]
tObj = getNodeByName ("BipToMesh_"+obj.name)

rc = Orientation_Constraint()
tObj.rotation.controller = rc
rc.appendTarget obj 100

pc = Position_Constraint()
tObj.position.controller = pc
pc.appendTarget obj 100

if (fpObj.children[i]) != undefined do
(
myFnSetupConstraints obj
)
)
)

myFnBipedToMesh selection[1]
« Viimeksi muokattu: Elokuu 31, 2008, 02:02:18 am kirjoittanut xcx »
Senior Technical Artist - Remedy Games
http://www.verajankorva.com