Scaling And Rotating AI Meshes

From The DarkMod Wiki
Jump to: navigation, search

Originally written by ascottk on http://forums.thedarkmod.com/topic/4641

Sometimes we don't like the size of an AI in-game. Do we manually resize the Maya binary or is there another way? Thankfully there is an other way to scale and rotate an AI.

Things you need

More information about this is found here:

A copy of Maya (any version from 4.5 through to 7.x) or the conversion will not take place.

First you need the source Maya binary (*.mb) that contains the AI you want to convert to an md5mesh & their respective md5anims.

Second you need the def file containing the export information (unaltered Builder Guard):

export builderguard {
   options -sourcedir models/mymodels/builder_guardmbs -destdir models/md5/chars/builders/guard
   mesh stance.mb -dest builderguardmesh
   
       anim af_pose.mb
       anim walk.mb
       anim run.mb -dest run

       anim idle.mb
       anim whack.mb -dest attack
}

After you get the environment variable set you fire up the Doom 3 editor & type in:

exportmodels tdm_ai_builder_guard

which is the file name of the def file.

But now he's too big & possibly the rotation is off 90 degrees.

The good thing is that the exporter has additional options you can tag on the def file. Namely:

-scale

or

-rotate

You can add these to the mesh definition or the animation definition:

   options -sourcedir models/mymodels/builder_guardmbs -destdir models/md5/chars/builders/guard -scale .90 -rotate 90
   mesh stance.mb -dest builderguardmesh
   addoptions -keep Hips LeftHips_Dummy LeftUpLeg LeftUpLegRoll LeftLeg LeftLegRoll LeftFoot LeftToeBase joint3 joint4 RightHips_Dummy RightUpLeg RightUpLegRoll RightLeg RightUpLegRoll RightLegRoll RightFoot RightToeBase joint5 joint6 Spine_Dummy Spine Spine1 Spine2 LeftShoulder_Dummy LeftShoulder LeftArm_Dummy LeftArm LeftArmRoll LeftForeArm LeftForeArmRoll LeftHand LeftHandIndex1 LeftHandIndex2 LeftHandIndex3 LeftHandRing1 LeftHandRing2 LeftHandRing3 LeftHandRing4 LeftHandThumb1 LeftHandThumb2 LeftHandThumb3 Neck Head RightShoulder_Dummy RightShoulder RightArm_Dummy RightArm RightArmRoll RightForeArm RightForeArmRoll RightHand RightHandIndex1 RightHandIndex2 RightHandIndex3 RightHandMiddle1 RightHandMiddle2 RightHandMiddle3 joint13 RightHandThumb1 RightHandThumb2 RightHandThumb3 joint8 leftpad rightpad joint7 sword -scale .90 -rotate 90
   anim af_pose.mb
   anim walk.mb
   anim run.mb -dest run

   anim idle.mb
   anim whack.mb -dest attack

For this example, the exporter will keep all of the animation joints that were referenced by the md5mesh, rotate 90 degrees clockwise, and scaled to 90% of the original Maya binary.

Known Problems

If you add the -keep joint option before the mesh definition, it is possible the exporter will not use the meshes you want. It's better to exportmodels, check which bones come in the md5mesh, and -keep any joints in the animations the md5mesh referenced. If the number of joints,and the joint hiearchy, in the md5anim do not match the md5mesh, then Doom 3 will crash.

http://www.iddevnet.com/doom3/modelexport.php