| 2 | [[TOC]] In this tutorial we are going to animate the crate/box object created in the previous [http://trac.wildfiregames.com/wiki/Basic3DImplementation tutorial] to demonstrate the process of importing a basic animated model into 0 A.D. This example can be extended to work with more complex models. |
| 3 | |
| 4 | Since this process is not extremely straightforward, I will preface this tutorial with some information about the game's 3D engine regarding animations. |
| 5 | |
| 6 | == Animations in 0 A.D. == |
| 7 | Animations in 0 A.D. rely on three types of files: * Meshes: those are the basic files that define how an object will look like in-game, such as the crate object in the [[Basic3DImplementation]] tutorial. Meshes also contain the "Armature", that is the bones that will be animated. |
| 8 | |
| 9 | * Animations: obviously, those files define animations. Each file can only define one animation. |
| 10 | * Skeletons: those define "Skeletons", an in-game concept that defines hierarchical relations between bones. You might think that this is redundant with the armature information in the Model files, and in fact it is. However, they are used to parse animations more easily. Each skeleton can be reused by many different models and animations, which adds a layer of abstraction on top of the 3D meshes. |
| 11 | |
| 12 | Using skeletons for animations makes the process a little tricky, so this tutorial will begin by explaining how to animate an object in Blender, then how to export it so that it works in 0 A.D.[[BR]]With that in mind, let's start. |
| 62 | |
| 63 | == Exporting the animated Model to 0 A.D. == |
| 64 | * '''STEP 1''' To export your mesh into 0 A.D. and for it to load without issues, your armature needs to conform to a Skeleton file. Therefore, the first step will be finding a proper Skeleton file for your armature or, if there is none, to create a new one.[[BR]] |
| 65 | * '''STEP 1-A: using an existing skeleton '''Skeletons are defined in `binaries\data\mods\public\art\skeletons`. Open rowing_boat.xml (why? Because it's one of the smallest files).[[BR]]You will notice two main parts: one defined by `<standart_skeleton>` and one by `<skeleton>`. This is because there is a default skeletons and we can define subsets from that (this helps support different 3D softwares).[[BR]](screenshot here)[[BR]]You will also notice a few `<bone>` identifiers, which are hierarchically defined (RowingBoatBone is the parent of RightRow and LeftRow). If you want to use this skeleton, your armature needs to conform to the skeleton file. In the case of the rowing boat skeleton, this means your model must have a bone named RowingBoatBone (see step 7) above, and then two bones RightRow and LeftRow which have RowingBoatBone as a parent (see step TODO), and no other bone. Update your model accordingly (note: using an existing skeleton only makes sense if your model fits the scheme. If you're designing a chicken, you should use the Chicken skeleton which will make more sense).[[BR]] |
| 66 | * '''STEP 1-B: creating a new skeleton''' Since our model is a crate, it doesn't make sense to use any existing skeleton. Thus, we will create our own. Copy any of the files in binaries\data\mods\public\art\skeletons and name it "CrateBox.xml". Then open this file in NotePad++. Erase everything and copy the following, then save the file: |
| 67 | |
| 68 | {{{ |
| 69 | TODO |
| 70 | }}} |
| 71 | * '''STEP 2 ''': Todo |