Jump to content
Official BF Editor Forums
[RC]MamboDog

Weapon animation tutorial for 3ds max

Recommended Posts

Updated 14.8.05

Okay, for anyone who still hasn’t figured out how to get your animations from 3ds max to the game, I’ve written this lil tute. It requires a sound knowledge of 3ds max, but not too much of the bf2 editor. Also make sure you read ahead a little, so you don’t do anything you’ll regret. This is mainly focusing on creating weapon animations for a whole new weapon, but as far as I know you can use it for generic 3p soldier anims and static anims as well… just skip the steps relating to weapons…

DISCLAIMER: I TAKE NO RESPONSIBILITY FOR ANYTHING BAD THAT HAPPENS TO YOU, OR ANYONE ELSE, OR ANYTHING, BELONGING TO ANYBODY, ANYWHERE, EVER, BEFORE, DURING, OR AFTER THE USE OF THIS TUTORIAL. Good things however, I don’t mind taking credit for… :D

Firstly, you’ll need these files if you don’t already have them: http://bf2.rex3d.net/files/3dsmax/RawData.rar

Now you’ll need to have exported your weapon to the game. This is the basic hierarchical structure to use:

animationheirarchy0sy.jpg

As far as I know, you can have up to 16 parts in the first person weapon, the names of which should begin with ‘mesh1’ to ‘mesh16’. In third person you can have up to 8 parts, again beginning ‘mesh1’ to ‘mesh8’.

Now open up the bf2 editor, load your mod and switch to the AnimationEditor. Load your weapon from the Resource list on the left. In the ‘Editor’ panel on the right, scroll down to ‘Soldier’ and click the ‘Create’ button just below where it says ‘Animation System’.

animationmenu17aw.jpg

Here you will have to select an existing animation system to use as a template for creating the new one. Obviously you want to select one that is functionally similar to the one you are trying to create. For some reason it doesn’t show the ones from parent mods (BF2), which would probably be useful. To rectify this you can temporarily extract the weapon whose animation system you want to clone to your mod’s folder, just remember to restart the bf2 editor. You can delete it after the editor is done duplicating its animation system. As far as I know you can select 1p or 3p, as the title of the window suggests it creates both the 1p and 3p animation systems.

animationsysselect8ch.jpg

Now head back to the ObjectEditor. Open up your weapon and in the ‘TweakerBar’ open ‘Animation’ (NOTE: not ‘Animation[Component]’). Under AnimationSystem1P and AnimationSystem3P respectively select the AnimationSystem1P.inc and AnimationSystem3P.inc files that you just created.

animationsysapply8es.jpg

You may want to fill in some other aspects of the weapon’s code at this point; it may make testing the animations easier. For example, you should set the weapon's ItemIndex if you want to be able to test it in the animation editor. In the TweakerBar under 'FireArm' you'll see the property 'ItemIndex'. Set the value to the number of the key (from 1-6) you want the player to press to select it. If it was a pistol, for example you would normally set it to 2. When you’re done here, save, exit and head back to 3ds max.

Back in 3ds max, it’s time to open up the scene you’re going to animate. At this point if you are what is known as a ‘l33t h4x0r’ you can use your ‘mad skillz’ to import the appropriate skeleton directly from the game files after editing Rexman’s skeImport.ms, but personally I prefer his ‘fatter’ template skeletons. In the RawData.rar file I told you to download earlier, under RawDataAnimation3dsmaxtemplates you will find template .max scenes including these skeletons. For those of you who are lazy like me, you can use Rexman’s example scenes instead, which have everything already in a nice position to give you a bit of a head start. They can be found in:

RawDataAnimation3dsmaxObjectsWeaponsHandheldMyPistolAnimations1p

RawDataAnimation3dsmaxObjectsWeaponsHandheldMyPistolAnimations3p

Just make sure you delete the existing mesh1 and mesh2, and the animation on the skeleton before continuing. Before you import your weapon model, make sure you set up the units for this scene to be the same as those in your weapon model scene. Now go File > Merge… Select your weapon model scene. In the Merge window, select only the weapon parts you want to animate. This means if you are doing a 1p animation, import the meshes under geom0_1p as shown here:

animationmerge5hk.jpg

If you were doing a 3p animation obviously you would use the parts from geom1_3pView. Now select these only these objects (if they aren’t already) and click Unlink Selection. If they are in the format ‘mesh1_Fp__HandFireArm’ will need to rename them to the ‘mesh1’ format. You can save time by going Tools > Rename Objects… and removing the last 16 chars. While they are still selected click Select and Link, then Select by Name. Link them to root_animation_whatever… (you should probably also rename this object to reflect the name of the weapon and animation you are currently working on… the format is root_animation_[1p/3p]_[weaponname]_[animationname]) Now move the lot into position and do your animating thang.

When you’re ready to export: If you are using IK solvers or anything like that, make sure you select the affected objects and go to the Motion tab, then under Trajectories, click Collapse. I generally set the Sample Range to create every frame for the whole timeline.

animationcollapse5qn.jpg

Now delete the IK solvers (you probably would want to make a backup before you do this though).

Click Select by Name. Under selection sets, select ANIMATED.

animationselectanimated3bz.jpg

Now add your animated weapon meshes (mesh1-mesh…) to the selection. Click select. Now go to Edit > Edit Named Selection Sets. Select ANIMATED and then click Add Selected Objects.

animationnamedselection5ip.jpg

Now go to BF2 > BF2 Exporter. The objects sub-folder path should say something like:

weapons/handheld/[weaponname]/Animations/[1p/3p]

and the Object Name:

[1p/3p]_[weaponname]_[animationname]

If you renamed the root object earlier this all should be filled in correctly. Now simply click ‘Export’.

animationexport9ko.jpg

Open up the bf2 editor again and switch to the AnimationEditor. Open your weapon from the Resource list on the left (you should have it bookmarked by now). Apart from the animations you have exported, the weapon animations will not be correct. This is normal. In the Editor panel on the right, click ‘Populate Animation Tree’.

animationpopulate8eb.jpg

Back in the Resource list, scroll down to ‘Animations’ and browse through to your weapon, and then to the animation you just exported.

animationlist0ld.jpg

Double click on it to give it a test. If you’ve done everything right, hopefully the viewer window will be playing your new animation. If so, w00t! You’ve done it! Now finish coding the weapon and add it to a kit, add that kit to a level, package the level and the mod. Enjoy. :D

By MamboDog.

Share this post


Link to post
Share on other sites

good tutorial now i can try animating too also you say that it didnt show up the bf2 parent folder try doing this.

mod > modmanagaer> editor content tab and check the boxes in there also select load parent mod content.

Share this post


Link to post
Share on other sites

I'm having no problems with it, but then again I am just modding the BF2 install since I dont play that anymore.

The Animation editor is VERY useful, TY for that piece of the mod tools DICE :D

One question, what does it mean when you add an effect to a animation?

Share this post


Link to post
Share on other sites

well.....arrgghh..i am certainly having some serious issues with this step.

damn good tutorial though..thanx

i follow the steps and when i merge the scenes the custom gun model is way too small..but when the gun is in the editor connected with the soldier it is the correct size...wtf is the go with that...lol

i would be greatful for some help with this..please and thankyou..lol

Share this post


Link to post
Share on other sites
well.....arrgghh..i am certainly having some serious issues with this step.

damn good tutorial though..thanx

i follow the steps and when i merge the scenes the custom gun model is way too small..but when the gun is in the editor connected with the soldier it is the correct size...wtf is the go with that...lol

i would be greatful for some help with this..please and thankyou..lol

You scaled up your model then did not reset the scale transform.

Share this post


Link to post
Share on other sites

the "absolute:local" size is 7.9 for the guns mesh...do i use the "offset:world" scaler to increase the size in max to solve that,but will that affect the mesh when exporting the animation?

Share this post


Link to post
Share on other sites

Very nice tutorial, I've got max but never use it, nows the time...

Looks like Rising Conflicts know what they are doing...great mod, great mod.

Share this post


Link to post
Share on other sites
the "absolute:local" size is 7.9 for the guns mesh...do i use the "offset:world" scaler to increase the size in max to solve that,but will that affect the mesh when exporting the animation?

- Hierarchy (the tab just to the right of the modifiers tab)

- Pivot (button to the left of IK and Link Info)

- Adjust Transform (rollout)

- Reset (group)

- Scale (button)

When working with animations or complex hierarchies (like with bf2 objects) you want to reset scale/transforms when necessary. On geometry it will prevent skew caused by non-uniform scales.

The merge/replace tool in 3dsmax does the same thing as copying that source object into the scene then setting the transform to the object it is replacing. Having a reset transform lets you replace geometry cleanly and predictably.

Share this post


Link to post
Share on other sites

It won't let me drag my weapon into the animation editor. It says:

"This weapon: [sm18] has an incorrect itemIndex -1 and cannot be picked up!"

Do I have to code the weapon or anythign before doing this?

There was already a soldier in the animation editor when I switched to it.

Share this post


Link to post
Share on other sites

You have to change the ItemIndex listing for it to show the weapon as 'pickupable'.

Just go to the ObjectEditor, find your weapon, and go to the Firearm tab on your TweakerBar.

Then change the ItemIndex tag there to 3 (granted its a rifle.. if the listings are the same as BF42/BFV, 1 is melee/knife, 2 is pistol type, 3 for rifles, 4 for grenades/misc, and 5 for more misc (explosives in engineer kits were on 5 and 6 as well if I remember correctly).

Share this post


Link to post
Share on other sites

I am having some problems. When I exported my model and tried to open it in the animation editor. I got a problem. However when I tried to open it in the object editor, it worked fine.

I got this error.

bf2modingproblem013wh.jpg

Can some one help me out? All I did so far is just export my model, copy all the textures on the gun folder (f335a) under a folder called Textures. That is all. I did the knife tutorial, but that was just replacing the knife from BF2. Sence this is creating a new weapon, well I guess I missed quite a lot of steps. All help would be appreciated.

I am fairly new to exporting in the BF series, so I dont know too much about this stuff, but I am really excited about this stuff.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×