Simple Animated Door Tutorial

How to create models in XSI and other 3D applications and make them work in Battlefront 1 & 2. Post models, tips for application usage and share anything XSI, 3DMax, SketchUp, etc.

Moderator: Moderators

Post Reply
FragMe!
Gametoast Staff
Gametoast Staff
Posts: 2244
Joined: Sat May 13, 2006 12:34 am
Projects :: Not sure keep changing my mind.
Games I'm Playing :: F1 and SWBF
xbox live or psn: No gamertag set
Location: Origin name GT_FragMe
Contact:

Simple Animated Door Tutorial

Post by FragMe! »

I was making a door for the DMI project when I thought it was a simple door so I should make a tutorial for
it so everyone can make their own doors.
Well I did and here it is. This should let you get a simple animated door into the game. You can also make more complex
doors but I'll let you experiment with that. :D

Simple Door Tutorial

Edit: and to answer the sure to be asked question, the export can only be done via the Pandemic exporter.
Repsharpshooters mshex doesn't do animations.




How to Make a Door for SW Battlefront II


Here is a quick tutorial on how to make an animated door that can be used in Star Wars Battlefront II.
This is a very simple door you can make more complex ones but I will leave that up to you to experiment with.

Step One make your door
For the purposes of this tutorial it is just composed of two simple rectangles.
Hidden/Spoiler:
Image
Once you have made the door and textured it to your liking, freeze all tranforms and freeze the modelling stack.



Step 2 The Bones
After you are satisfied with that create 3 nulls, name them bone_root bone_doorl and bone_doorr (the last two you can call what you like)
Place them in the tree as shown above. (personal preference I moved the door bones to mid door that way I can see them better and don't get confused with the bone_root)



Step 3 and 4 Enveloping and animating the door.
These steps are combined as they can be done either way enveloping then animation or vice versa, I like to envelope first so I can see the door parts move.
Enveloping for the door is quite easy select a door piece, say door_left select Evelope/Set Envelope answer yes to the pop up. Now in the XSI tree because it is
easier left click on bone_doorl then right click. If done right bone_doorl should change color and so should the vertexes on the model. Now do the same thing for
the right door this time choosing bone_door right. (see below)
Hidden/Spoiler:
Image


Animating
Okay now lets make that door open, you will notice at the bottom in the playback window by default is starts a frame 1 and goes to 100 we need to change this, change the 1 to a 0
and change 100 to 30, this will make the door animation about 1 second which is a good duration. Now for the animation, first click on the bone_root the on the three bars under the t
in the transform window. (should always make sure all three x,y,z are enabled)
Go to frame 0 the click on the key symbol, shown in yellow below, although it may also be grey but after you click on it it should turn red, you have just made a keyframe.
Next go to frame 1, pushing the small > down by playback will get you there. Press the key thing again to make another keyframe, finally go to frame 30 and do it again.
Do the same thing for bone_doorl and bone_doorr but only do frames 0 and 1.
Okay that was the boring part now the fun part. Select bone_doorl and go to frame 30 then using transform move it to the open position, in my case it was moving it to 2.
Press the key again to create a keyframe. Do the same for bone_doorr. You can press play now and watch the door open see if you like it.
Hidden/Spoiler:
Image

Okay finished playing? There is one more thing we need to do on the animation, click on the little box at the bottom with 2 squares and a squiggly line. This opens up the animation
editor. You will have to change one of the windows back to XSI explorer to make it easier. And it should look like below.
Hidden/Spoiler:
Image


Select each bone in turn, then in the animation editor click on the name of the bone on the left side it should turn blue then click on the button indicated by the red arrow. What this does
is it makes the animation linear which BF2 likes better. (To get back to the original for square boxes just press the symbol with 4 square boxes at the bottom)

Okay so that is pretty much it for animation but not for the model.


Step 5 Collision Primitives
You will now need to make collision primitives for the doors or people can shoot right though them. Remember the only primitive that can be scaled is a cube the others need to be set in the original
pop up box. And never freeze or freeze transforms on a primitive.
Now having said that make two rectanges the size of the door parts. Rename the p_-svbot-doorl and p_-svbot-doorr (the name at the end can be whatever you like)
Move these collisions to the appropriate bones (see below)
Hidden/Spoiler:
Image


Step 6 Trigger
The last thing to do before export is to put in the trigger for the door this can be a null or a primitive I prefer to use a primitive cube. Size it to what you prefer and place it at the bottom of the door.
You can call it hp_anything you want but normally it is hp_active or hp_door.
Hidden/Spoiler:
Image

Step 7 Exporting
One last thing to create before exporting, and i just found this out so there is no picture sorry, but create a lowres version of the door and don't hide it.
This will allow you to see door in ZE for placement otherwise you will just see the bounding box.
The first step in exporting is like any other, branch select the dummyroot, choose a file name and place it in your worlds msh folder. The only thing to make sure of is that the animation is at frame 0
Clicking on the |< will get you there.
For the the next step we need to do a little windows work first. Look in you map folder and you should see an Animation folder in that folder create another one call props, in that folder create another one
with the name of your door. For this tutorial I called mine simpledoor.

Now to export the animations, some other tutorial say delete all the meshes and things so you are just left with the bones that does work bit I prefer to
just move everything but the bones out of the dummyroot, your choice both methods work.
Drag all the bits, door_left door_right hp_active, p_-svbot-doorl and p_-svbot-doorr up to the Scene_Root. It should look like in the tree below or if you deleted things just the bones
will be there.
Hidden/Spoiler:
Image

Now to export the basepose. Change the 30 on the timeline to 1. Make sure you are on frame 0. Using Pandemics exporter browse to the folder you made earlier and save the file
as basepose with the options as shown above.

Next change the 1 back to 30 and change the 0 to 1 on the timeline. This time make sure you are on frame 1. Export it to the same place as the basepose but this time call it something like open.
Yes I know it's original but hey it works and it is simple. Oh don't worry about the error at the bottom of the screen it is normal and doesn't affect the export.
Hidden/Spoiler:
Image


Save your work and you are done, with XSI at least.

Just a note for those who are hoping to create a door in modtools6 and get a buddy to export it for you, don't, no just kidding. Export it as a model (emdl) it preserves the bones and other bits.
Also they will have to redo all the collision primitives as any kind of export seem to make them lose their primitive values and therefore won't work in game.

Okay now on the the messy BF2_ModTools bits.



Step 8 Creating the anims in BF2_ModTools.
From the Assets/Animation folder copy all the .bat files and place them in your animation folder. Next click on the prop folder and copy the munge_animation.bat to your prop folder. And one more click
on any prop folder and copy the munge.bat files to the folder you named your door.

Now edit the munge.bat in your doors folder, change it from whatever it says to something like below substituting in the name of your door and the 3 letter name of your world. In my case simpledoor and my world name is BAH. Then save the file.

Code: Select all

@call ..\munge_animation.bat "/keepframe0 /specialquathack /dest simpledoor.zaf" Worlds\BAH
Next go to the munge.bat in the animation directory and edit it so it looks like the following (once again using your doors directory name)

Code: Select all

@REM munge.bat
@REM Calls %1\munge.bat for all animation subdirectories

@REM soldier animation banks
@call munge_subdir.bat SoldierAnimationBank\sitting


@REM first person animation banks


@REM addons


@REM vehicles


@REM props

@call munge_subdir.bat Prop\simpledoor

Now just because we all know that visualmunge has it's problems why should animation be any different. VM does not automatically munge animations. What you need to do is manually run the
munge.bat that is in the animation root directory. Just doulbe click on it and you'll see a window with a bunch of things scoll by. To check to see if it did its job correctly go to the munged folder
in you world directory and you should see three files with your doors name on it.



Step Nine
The ODF
This is the easy bit
Just create and odf that looks like this:

Code: Select all

[GameObjectClass]       

ClassLabel  =   "door"
GeometryName    =   "simpledoor.msh"


[Properties]        

GeometryName	=   "simpledoor"
AnimationName	= "simpledoor"
Animation         	=  "open"

AnimationTrigger   = "hp_door 5.0"

OpenSound = "door_open"
CloseSound = "door_close"
LockedSound = "vehicle_equip"
FoleyFXGroup    = "metal_foley"

The last bits for sounds etc you can change to suit your needs. The 5.0 in the animation trigger line determines how far away from the door you can be before it opens.
Higher the number the farther away you can be.


Next place it in ZE (you may not see the door msh but you will see the bounding box once you select it so you can move it around, I am still working on the seeing it part)
Just figured it out, in XSI create a lowres version of the door and put in under the dummyroot. It needs to be in this format door_lowres. (the name can be what you like but
the _lowres must be there) Do not hide it, this will allow you to see it in ZE and even though it wasn't hidden it will not show up in game until you get far enough away from
the door.

Munge and play and walk through your door.



Now the inevitable it didn't work, my map just CTD before it is finished loading. If you did something wrong then yes it will.
Animations are one of the things that will cause a CTD and won't give any error messages.
All I can say is doublecheck your work and try again.
Make sure the animation files are in the munged folder.
A couple things to make sure of in XSI are that you froze the modelling stack (doing so after you have enveloped it will remove the envelope so you will have to reapply it. Don't worry though it won't
affect the animation) and that you were on the first frame of the animation before exporting.

You can also check the ZenAsset.log in your doors directory in the animation folder. It shouldn't say much more than this:

Code: Select all

-- Processing directory C:\BF2_ModTools\data_BAH\Animations\Prop\simpledoor
	Processing file basepose.msh, will save in .\\\simpledoor.zaf
*** WARNING: While correcting joint base pose matrices, no skin was found!
*** ERROR: No Skin model in MSH?
User avatar
AceMastermind
Gametoast Staff
Gametoast Staff
Posts: 3284
Joined: Mon Aug 21, 2006 6:23 am
Contact:

Re: Simple Door Tutorial

Post by AceMastermind »

Nice job on the tutorial, even though we do things slightly different and they both seem to work which is an indication of there being more than one way to do it. :)
I Just skimmed over it but a couple of things I noticed, in Step #8 you can save time by munging your animations by clicking on the munge.bat that resides in the same folder as your raw animations, just edit that one with your desired animation name and destination, but no other bat files need editing.
Also, XSI 6 Mod Tool isn't capable of exporting as emdl, it's one of those limitations of the free version.
I don't key anything on frame zero, all of my keys sit on frame 1 to whatever.
I usually delete all meshes from the hierarchy before exporting the animations and then just ctrl+z a couple of times to undo to get them back like they were when i'm done, but I always save my scene before starting to export anything.

You can get an animated door template emdl from psych0fred's site here:
http://www.secretsociety.com/forum/down ... onEMDL.zip

EDIT
Added FragMe!'s tutorial to his post so we have it on-site. Now we don't have to worry about broken download links. :)
JabbaLovesLava
Sith
Sith
Posts: 1396
Joined: Tue Jun 07, 2005 11:50 am

Re: Simple Door Tutorial

Post by JabbaLovesLava »

Nice tutorial. Clean and easy to understand. :)


PS: It would be fun to put a trigger box before the door, so you gotta work with a teammate to go thru it. :P
FragMe!
Gametoast Staff
Gametoast Staff
Posts: 2244
Joined: Sat May 13, 2006 12:34 am
Projects :: Not sure keep changing my mind.
Games I'm Playing :: F1 and SWBF
xbox live or psn: No gamertag set
Location: Origin name GT_FragMe
Contact:

Re: Simple Door Tutorial

Post by FragMe! »

@AceMastermind
Thanks Yes I guess the is more than one way to model cat (don't feel like skinning) For step 8 I like doing it the other way because I will usually have more than one animation and that munge gets them all. Hey I'm lazy :D

Depending on what I am animating I to will delete them all, but something simple like a door just as easy to move them.
Did at one point try the template from pysch0fred's but as I found out the collision primitives would need to be redone.

No model export, I guess that's why modtools 6 is free. Might have to experiment with an normal crosswalk export then.

@JLL
yes you could put the trigger anywhere, and see how fast you have to run to get through the door
User avatar
ps2owner
Corporal
Corporal
Posts: 155
Joined: Wed Jun 23, 2010 8:25 pm

Re: Simple Animated Door Tutorial

Post by ps2owner »

the link sends me back to the homepage (gametoast.com)
User avatar
DarthD.U.C.K.
Master of the Force
Master of the Force
Posts: 6027
Joined: Wed Sep 27, 2006 11:05 am
Location: Duckburg, Germany

Re: Simple Animated Door Tutorial

Post by DarthD.U.C.K. »

ive reuploaded it here
Post Reply