Animated static objects: Difference between revisions
m formatting |
|||
Line 4: | Line 4: | ||
Animations can be done in a 3d program such as 3dsMax, [http://www.blender.org/ Blender], Lightwave or Maya and exported to ''md5mesh'' files along with ''md5anim'' files. | Animations can be done in a 3d program such as 3dsMax, [http://www.blender.org/ Blender], Lightwave or Maya and exported to ''md5mesh'' files along with ''md5anim'' files. | ||
An | An md5mesh file contains the object and bones info. Objects need to be an edit mesh with a skin modifier. The skin modifier attaches the bones to the mesh (object). The md5anim file contains the animation keyframes. Each animation file has it's own md5anim. This is the same as AI use. For instance a city guard would have a city_guard.md5mesh (containing the AI's data and joints [bones]) and many md5anims such as city_guard_attack1.md5anim (which would obviously be an attack anim). Scripts can be used to call up these anims. | ||
Static objects whether animated or not need several files to define them. | Static objects whether animated or not need several files to define them. |
Revision as of 07:52, 22 August 2007
Description of object files
In The Dark Mod it is possbile to have 'static' objects that are animated. A static object is basically anything other than an AI (a chest, a building, a piece of loot). In Dromed this was done by use of joints or multiple models via Tweq settings. In TDM this is done differently.
Animations can be done in a 3d program such as 3dsMax, Blender, Lightwave or Maya and exported to md5mesh files along with md5anim files.
An md5mesh file contains the object and bones info. Objects need to be an edit mesh with a skin modifier. The skin modifier attaches the bones to the mesh (object). The md5anim file contains the animation keyframes. Each animation file has it's own md5anim. This is the same as AI use. For instance a city guard would have a city_guard.md5mesh (containing the AI's data and joints [bones]) and many md5anims such as city_guard_attack1.md5anim (which would obviously be an attack anim). Scripts can be used to call up these anims.
Static objects whether animated or not need several files to define them.
- A non-animated object uses an .ase file (3ds max native) or .lwo file (Lightwave native) to describe the mesh and which material shader/s it contains. This also contains shadow meshes and collison meshes.
- An animated object uses the above mentioned .md5mesh file for this purpose. (wether or not it can contain a shadow or collison data is not yet confirmed - my next project)
- A .mtr file which contains the material shader descriptions (this is referenced by the md5mesh, ase or lwo file)
- Some objects will also have .def files. This is a deffinition of the object. It defines characteristics such as frobability (can player use it, pick it up?), a list of animations, sounds an object makes, and a bounding box for the object among many other options. If an object has a .def file it will need to be created as an entity in the editor, not a model, although its model can still be referenced in the model viewer.
On to animated objects
Static non-animated objects are described further here (make this a link):
Proper placement of md5 files is as such:
darkmod/models/md5/gfclock (the grandfather clock files would go here), textures can go here also, or in darkmod/models/textures
A drawback to animated objects is that they don't have collision data, the player can walk through them, arrows can be shot through them. This however can be remedied (?) by adding data to the objects .def file. Below is an example of the grandfather clocks .def file.
Code
//grandfather clock obj by who? //anything behind double foward slash is comment, not read by game... model gfclock { mesh models/md5/props/gfclock/gfclock.md5mesh anim idle models/md5/props/gfclock/gfclock_idle.md5anim { random_cycle_start } }
entityDef atdm:furniture_gfclock { "spawnclass" "idAnimated" "model" "gfclock" "editor_mins" "-12 -12 -52" "editor_maxs" "12 12 52" "size" "24 24 104" "start_anim" "idle" "CombatModel" "1" }
Description of code
- model gfclock - name of model (gfclock.md5mesh)
- mesh models/md5/props/gfclock/gfclock.md5mesh (path to mesh)
- anim idle models/md5/props/gfclock/gfclock_idle.md5anim (path to anim/s) currently anim idle is an animation of the pendulum swinging back and forth. It could be changed in the future to be a blank anim, the clock is idle/not doing anything. Then more anims would be listed such as:
- anim running models/md5/props/gfclock/gfclock_running.md5anim (this way it could be 'wound' by player (frobbed), and thru a script it would turn on)
- random_cycle_start -edit this, not sure what it means exactly
Now that we've got the model and paths out of the way we come to the entity descriptions. This is what effectively takes the model and changes it from a model which does nothing in game, to an entity which is almost limitless through use of properties, scripts and ingenuity.
- entityDef atdm:furniture_gfclock - the name that will be in the editor entity list. (atdm is used so it can be found in list with all other DarkMod entities, furniture further catagorizes it for ease of use)
- "spawnclass" "idAnimated" - all entities are 'spawned' when the game loads, they have to have a class to which they belong. In this case it is idAnimated which will let it run animations. This however causes the problems with being able to walk through the object. I believe these classes are defined somewhere in the gamecode itself so certain props need added to a def file to fix the problems.
- "editor_mins" "-12 -12 -52"
- "editor_maxs" "12 12 52"
- "size" "24 24 104" - fairly obvious, size of bounding box for object in game. These 3 props add a player/AI collision model. Now the object can't be walked through. But you can't hide behind it either 'cause a guard can shoot an arrow through it. So we need to add
- "CombatModel" "1" - this creates yet another bounding box around the object, this stop projectiles from going through the object. I believe this can be changed to a few shapes such as a cylinder for more realistic physics.
- "start_anim" "idle" - and this obviously tells game which anim to start with.
Other info
The clocks material file has wood as a material type. The description of wood in the .mtr file is what causes arrows to stick to it and to make it sound like wood.
Go in game, pull down console and type
g_showcollisionmodels
The red box drawn around the object is the player collision model, the blue box is the combat model.
Der_tons md5 model exporter works great for exporting the model/anim. He has several versions. I have only used the 3dsMax one. There are other useful tools in that list.