ofp:modeling:brsseb_lesson9
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
ofp:modeling:brsseb_lesson9 [2008/10/06 08:10] – fixed typos. snakeman | ofp:modeling:brsseb_lesson9 [2024/07/31 15:54] (current) – links added. snakeman | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== OFP Brsseb 3D Modeling Tutorial ====== | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | **Operation Flashpoint (OFP)** aka ArmA: Cold War Assault (CWA) | ||
+ | |||
+ | |||
====== Lesson 9: Custom Object Animations ====== | ====== Lesson 9: Custom Object Animations ====== | ||
Line 13: | Line 20: | ||
* Some basic OFP configfile OR C++ skills will also be helpfull | * Some basic OFP configfile OR C++ skills will also be helpfull | ||
- | Im assuming you either have done all or most of my other tutorials or are experienced in modeling and the o2 interface. Also, making object animations are mostly configfile work, so you better have some experience in basic configfiles and/or be familiar with some basic programming issues (C++). But as always, I`ll will provide you with what you need and will tell you how to do everything right. The goal of this tutorial is to serve as a reference or template for your own addons and you are free to use whatever code or tricks you learn from the tutorial. | + | Im assuming you either have done all or most of my other tutorials or are experienced in modeling and the o2 interface. Also, making object animations are mostly configfile work, so you better have some experience in basic configfiles and/or be familiar with some basic programming issues (C++). But as always, I`ll will provide you with what you need and will tell you how to do everything right. The goal of this tutorial is to serve as a reference or template for your own addons and you are free to use whatever code or tricks you learn from the tutorial. |
- | Please note that you need version 1.85 (Resistance plus patch) or higher to to this tutorial since the animation code used is not compatible with older OFP versions! I will be using Eventhandlers, | + | Please note that you need version 1.85 (Resistance plus patch) or higher to to this tutorial since the animation code used is not compatible with older OFP versions! I will be using Eventhandlers, |
Lets get started! | Lets get started! | ||
Line 23: | Line 30: | ||
The model is all done. No need to model anything really, its all LOD and config work, plus a lot of theory on how all works. The model is really a garage style building. It has a main garage door big enough to park a small car inside, a switch to operate it, a small side door for the units to walk through and, last, a cool rotating satellite dish on the roof just for the fun if it :). | The model is all done. No need to model anything really, its all LOD and config work, plus a lot of theory on how all works. The model is really a garage style building. It has a main garage door big enough to park a small car inside, a switch to operate it, a small side door for the units to walk through and, last, a cool rotating satellite dish on the roof just for the fun if it :). | ||
- | {{ http://tactical.nekromantix.com/images/wiki/ | + | {{ https://pmc.editing.wiki/ |
//Two shots of the tutorial model we will be using.// | //Two shots of the tutorial model we will be using.// | ||
- | The goal of the tutorial is to show you the most common animation types and tricks used on addons. Although the animation abilities for static objects in OFP is very limited, with the right tricks and settings you can still do some cool stuff. I will show you some of this in this tutorial. | + | The goal of the tutorial is to show you the most common animation types and tricks used on addons. Although the animation abilities for static objects in OFP is very limited, with the right tricks and settings you can still do some cool stuff. I will show you some of this in this tutorial. |
- | Get the project folder with textures and configfile | + | Get the project folder with textures and configfile Brsseb_lesson9_start.rar |
Lets look at the basic model together first. | Lets look at the basic model together first. | ||
- | {{ http://tactical.nekromantix.com/images/wiki/ | + | {{ https://pmc.editing.wiki/ |
//The 0.00 LOD// | //The 0.00 LOD// | ||
The model consist of 3 walls and a front garage door structure. There is a hole in the side wall with a door cube. On the other wall, there is a console with a soon-to-be-operatable switch. On top there is a half-sphere that is shaped into a radar or satellite dish form. The model got some basic textures and don't look too bad for a tutorial modl (I hope). | The model consist of 3 walls and a front garage door structure. There is a hole in the side wall with a door cube. On the other wall, there is a console with a soon-to-be-operatable switch. On top there is a half-sphere that is shaped into a radar or satellite dish form. The model got some basic textures and don't look too bad for a tutorial modl (I hope). | ||
- | {{ http://tactical.nekromantix.com/images/wiki/ | + | {{ https://pmc.editing.wiki/ |
//The Geometry LOD// | //The Geometry LOD// | ||
The Geo lod got the walls and all the doors covered, with only the floor missing (see lesson 8 to learn why). Note that the door cubes are thicker than the original structures in 0.00 LOD. This is because they were too thin to work properly (a running soldier would bash right though it), so I made them a bit thicker. You will hardly notice it ingame, though. | The Geo lod got the walls and all the doors covered, with only the floor missing (see lesson 8 to learn why). Note that the door cubes are thicker than the original structures in 0.00 LOD. This is because they were too thin to work properly (a running soldier would bash right though it), so I made them a bit thicker. You will hardly notice it ingame, though. | ||
- | {{ http://tactical.nekromantix.com/images/wiki/ | + | {{ https://pmc.editing.wiki/ |
//The LandContact LOD// | //The LandContact LOD// | ||
- | The landcontact was explained in lesson 8 and all it does is creating a walkable area for the units to walk and drive on. | + | The landcontact was explained in lesson 8 and all it does is creating a walkable area for the units to walk and drive on. |
- | So, what we are gonna do is getting the garage door and the side door to open and close when the player walks up to them (you will get an option on the action menu). We are also gonna set up the switch so that it controls the main garage door. Then we are gonna make the radar on top of the garage to constantly spin around. | + | So, what we are gonna do is getting the garage door and the side door to open and close when the player walks up to them (you will get an option on the action menu). We are also gonna set up the switch so that it controls the main garage door. Then we are gonna make the radar on top of the garage to constantly spin around. |
Move on! | Move on! | ||
Line 53: | Line 60: | ||
====== Setting up " | ====== Setting up " | ||
- | First we need to set up some selections in 0.00 LOD. The OFP engine need to know what part is the garage door, what is the side door and whats the radardome, etc. We do that by assigning the various parts to selection labels, which in turn is " | + | First we need to set up some selections in 0.00 LOD. The OFP engine need to know what part is the garage door, what is the side door and whats the radardome, etc. We do that by assigning the various parts to selection labels, which in turn is " |
Lets get started right away: | Lets get started right away: | ||
Line 62: | Line 69: | ||
* Select all the parts making up the radar dome and name it all " | * Select all the parts making up the radar dome and name it all " | ||
- | {{ http://tactical.nekromantix.com/images/wiki/ | + | {{ https://pmc.editing.wiki/ |
//Here is a review of all the labels you need in 0.000 LOD// | //Here is a review of all the labels you need in 0.000 LOD// | ||
Line 72: | Line 79: | ||
* Select the simplified radar half-sphere and name it " | * Select the simplified radar half-sphere and name it " | ||
- | {{ http://tactical.nekromantix.com/images/wiki/ | + | {{ https://pmc.editing.wiki/ |
//Here is a review of all the labels you need in Geometry LOD// | //Here is a review of all the labels you need in Geometry LOD// | ||
- | OK then we are done with Geometry and 0.000 LOD. But we need another, all-important lod..Memory LOD | + | OK then we are done with Geometry and 0.000 LOD. But we need another, all-important lod..Memory LOD |
Next! | Next! | ||
Line 81: | Line 88: | ||
====== Memory LOD ====== | ====== Memory LOD ====== | ||
- | In Memory LOD we define the " | + | In Memory LOD we define the " |
Lets go: | Lets go: | ||
Line 89: | Line 96: | ||
* Go back to 0.000 lod and, in Top view, focus on the vertical pole (cylinder) holding the radar. drag-select the inner vertices so that you got both center-vertices on the pole selected, like this: | * Go back to 0.000 lod and, in Top view, focus on the vertical pole (cylinder) holding the radar. drag-select the inner vertices so that you got both center-vertices on the pole selected, like this: | ||
- | {{ http://tactical.nekromantix.com/images/wiki/ | + | {{ https://pmc.editing.wiki/ |
//Select the two vertices that define the centerline of the cylinder.// | //Select the two vertices that define the centerline of the cylinder.// | ||
Line 95: | Line 102: | ||
* Rename the two vertices " | * Rename the two vertices " | ||
- | {{ http://tactical.nekromantix.com/images/wiki/ | + | {{ https://pmc.editing.wiki/ |
* Next, we need the axis for the garage door. We use the same trick. Head back to 0.00 LOD | * Next, we need the axis for the garage door. We use the same trick. Head back to 0.00 LOD | ||
* In left view, zoom in on the top of the garage structure and drag-select the rear set of vertices. Copy it too and head back to memory lod and paste it there. | * In left view, zoom in on the top of the garage structure and drag-select the rear set of vertices. Copy it too and head back to memory lod and paste it there. | ||
- | {{ http://tactical.nekromantix.com/images/wiki/ | + | {{ https://pmc.editing.wiki/ |
* Delete the " | * Delete the " | ||
- | {{ http://tactical.nekromantix.com/images/wiki/ | + | {{ https://pmc.editing.wiki/ |
* Next, we need the axis for the switch. Still the same trick. Head back to 0.00 LOD | * Next, we need the axis for the switch. Still the same trick. Head back to 0.00 LOD | ||
* In front view, zoom in on the bottom switch structure and drag-select the front-mostset of vertices. Copy it too and head back to memory lod and paste it there. | * In front view, zoom in on the bottom switch structure and drag-select the front-mostset of vertices. Copy it too and head back to memory lod and paste it there. | ||
- | {{ http://tactical.nekromantix.com/images/wiki/ | + | {{ https://pmc.editing.wiki/ |
* Delete the " | * Delete the " | ||
- | {{ http://tactical.nekromantix.com/images/wiki/ | + | {{ https://pmc.editing.wiki/ |
- | OK, that's 3 of 4. The last one is easy to make but can be tricky to configure. So far we have created axises that makes an object rotate around it. All the stuff we have made so far are for either doors that swing open, a switch that flips and a spinning radar structure. All those are rotating objects in one way or the other. But what if we want a structure to slide, like a side door on a Huey, car or doorway? | + | OK, that's 3 of 4. The last one is easy to make but can be tricky to configure. So far we have created axises that makes an object rotate around it. All the stuff we have made so far are for either doors that swing open, a switch that flips and a spinning radar structure. All those are rotating objects in one way or the other. But what if we want a structure to slide, like a side door on a Huey, car or doorway? |
Well, the truth is that you cant. OFP does only rotations, its a silly engine limit. But we can fake it to some degree. What if we place the axis faaaaaaaarrrr away from the actual door structure. And let it rotate only a small degree? Done right, and given that the door structure isn't too big, it might just look like the door slides linearly without rotating! See this illustration: | Well, the truth is that you cant. OFP does only rotations, its a silly engine limit. But we can fake it to some degree. What if we place the axis faaaaaaaarrrr away from the actual door structure. And let it rotate only a small degree? Done right, and given that the door structure isn't too big, it might just look like the door slides linearly without rotating! See this illustration: | ||
- | {{ http://tactical.nekromantix.com/images/wiki/ | + | {{ https://pmc.editing.wiki/ |
//(But-ugly :) ) Drawing explaining how having the axis point farther away from the door " | //(But-ugly :) ) Drawing explaining how having the axis point farther away from the door " | ||
- | This is the main trick used to create sliding doors in ofp and it works quite well in most cases. Problem is that the larger the door is (say a hangar door), the more movement is needed to open the door (larger angle) and the more apparent the rotating effect will be. A trick would be to split the door into smaller doors and have them rotate separately, but it can be tricky to pull off. | + | This is the main trick used to create sliding doors in ofp and it works quite well in most cases. Problem is that the larger the door is (say a hangar door), the more movement is needed to open the door (larger angle) and the more apparent the rotating effect will be. A trick would be to split the door into smaller doors and have them rotate separately, but it can be tricky to pull off. |
- | For out sliding door, which is quite small, we wont have much problem. Figuring out a good location for the axis AND tuning the right rotation angle (more on that in the configfile in the end) is the main problem getting this trick to work. Thankfully for you I've already found a good spot for it :). | + | For out sliding door, which is quite small, we wont have much problem. Figuring out a good location for the axis AND tuning the right rotation angle (more on that in the configfile in the end) is the main problem getting this trick to work. Thankfully for you I've already found a good spot for it :). |
Lets rock: | Lets rock: | ||
Line 133: | Line 140: | ||
* Select BOTH vertices and name then " | * Select BOTH vertices and name then " | ||
- | {{ http://tactical.nekromantix.com/images/wiki/ | + | {{ https://pmc.editing.wiki/ |
- | Now if you understood the trick, you will know see we got an axis far away from the model and by letting the door move just a small degree, it will look like its sliding, and not rotating. The goal is to have the door slide along the door rail. | + | Now if you understood the trick, you will know see we got an axis far away from the model and by letting the door move just a small degree, it will look like its sliding, and not rotating. The goal is to have the door slide along the door rail. |
- | You gotta watch out for some issues when making an axis. If any of the doors seems to rotate the OPPOSITE direction then you compile the addon (don't do that yet, still some more stuff do to), then you gotta go back in o2 and //reverse// the axis, either by selecting it and hitting W or by swapping the vertice positions of an axis. I talked about this in lesson 6, and you should already know this. | + | You gotta watch out for some issues when making an axis. If any of the doors seems to rotate the OPPOSITE direction then you compile the addon (don't do that yet, still some more stuff do to), then you gotta go back in o2 and //reverse// the axis, either by selecting it and hitting W or by swapping the vertice positions of an axis. I talked about this in lesson 6, and you should already know this. |
- | Also, one thing that might cause trouble when doing your own " | + | Also, one thing that might cause trouble when doing your own " |
The last thing we gotta do is create some single vertices in various places to be used as trigger points for the action menu items (more on that in the configfile section). We need to place two vertices, one near the side door and one near the switch. Lets go: | The last thing we gotta do is create some single vertices in various places to be used as trigger points for the action menu items (more on that in the configfile section). We need to place two vertices, one near the side door and one near the switch. Lets go: | ||
Line 145: | Line 152: | ||
* Still in Memory LOD, create a vertex near the center of the side door structure. Name it " | * Still in Memory LOD, create a vertex near the center of the side door structure. Name it " | ||
- | {{ http://tactical.nekromantix.com/images/wiki/ | + | {{ https://pmc.editing.wiki/ |
* Add another vertex near the switch console and name it " | * Add another vertex near the switch console and name it " | ||
- | {{ http://tactical.nekromantix.com/images/wiki/ | + | {{ https://pmc.editing.wiki/ |
- | I`ll talk more about the points later. Now we are done with the p3d, so before we move on to the configfile and compiling the addon, make sure you have done all the steps right and that you got no typos in the labels. | + | I`ll talk more about the points later. Now we are done with the p3d, so before we move on to the configfile and compiling the addon, make sure you have done all the steps right and that you got no typos in the labels. |
Next! | Next! | ||
Line 159: | Line 166: | ||
Time for the main attraction :), the configfile. This is where all the magic in object animation lies. Here we define the animations and control how they will be operated by the user. I assume you already know a bit about configs and how a basic house config looks like, so ill quickly skip to the new stuff. | Time for the main attraction :), the configfile. This is where all the magic in object animation lies. Here we define the animations and control how they will be operated by the user. I assume you already know a bit about configs and how a basic house config looks like, so ill quickly skip to the new stuff. | ||
- | {{ http://tactical.nekromantix.com/images/wiki/ | + | {{ https://pmc.editing.wiki/ |
//Common stuff so far (I hope)// | //Common stuff so far (I hope)// | ||
Our house-class (or Fortress in this case, the subclass for houses isnt all that important. Fortress will do just fine) got a model and foldername named // | Our house-class (or Fortress in this case, the subclass for houses isnt all that important. Fortress will do just fine) got a model and foldername named // | ||
- | {{ http://tactical.nekromantix.com/images/wiki/ | + | {{ https://pmc.editing.wiki/ |
* The animation class define how each animation type will perform. | * The animation class define how each animation type will perform. | ||
- | The animationclass is the most important new stuff here. It defines like what stuff to rotate, the name of the axis to rotate around, how long the animation takes to run and the angle (or amount of movement if you will) in radians to rotate. Each animation is given a class name (like ani_sideDoor) which will later be used to run them. | + | The animationclass is the most important new stuff here. It defines like what stuff to rotate, the name of the axis to rotate around, how long the animation takes to run and the angle (or amount of movement if you will) in radians to rotate. Each animation is given a class name (like ani_sideDoor) which will later be used to run them. |
- | If you want to run an animation " | + | If you want to run an animation " |
- | If you look closely you will notice that all but the ani_radarDome looks similar to the other classes. The ani_radarDome is unique in this case since the radardome is supposed to spin around forever, not just move a certain degree (like the garage door moves from 0 to -1.5 (" | + | If you look closely you will notice that all but the ani_radarDome looks similar to the other classes. The ani_radarDome is unique in this case since the radardome is supposed to spin around forever, not just move a certain degree (like the garage door moves from 0 to -1.5 (" |
If you study it, you will notice that the radar dome animation settings seem pretty odd. And they sure are! They seem to have an very large angle1 (60000+ in radians) and the animPeriod is set to 100.000. Well, the truth is that ofp didn't support constant rotating animations (except for some hard coded ones like the ship class` radar) and with normal settings and a angle1 set at 2*3.14159 (360*), it would just rotate one cycle and then stop. But thanks to some pioneers on the forums, they found a way to break this limit and create a constant spinning animation. Basically by setting the angle1 AND animPeriod to very high, you will force the radar to rotate slowly around the axis multiple times. It wont be forever, but with such a high angle (60.000 radians is A LOT of degrees!) and the time set to 100000 it will most certainly run for hours before it stops, and most people wont ever see it finally stopping. | If you study it, you will notice that the radar dome animation settings seem pretty odd. And they sure are! They seem to have an very large angle1 (60000+ in radians) and the animPeriod is set to 100.000. Well, the truth is that ofp didn't support constant rotating animations (except for some hard coded ones like the ship class` radar) and with normal settings and a angle1 set at 2*3.14159 (360*), it would just rotate one cycle and then stop. But thanks to some pioneers on the forums, they found a way to break this limit and create a constant spinning animation. Basically by setting the angle1 AND animPeriod to very high, you will force the radar to rotate slowly around the axis multiple times. It wont be forever, but with such a high angle (60.000 radians is A LOT of degrees!) and the time set to 100000 it will most certainly run for hours before it stops, and most people wont ever see it finally stopping. | ||
- | {{ http://tactical.nekromantix.com/images/wiki/ | + | {{ https://pmc.editing.wiki/ |
// | // | ||
- | The UserAction class defines how the player interacts with the animations. We basically want an action appearing on the action menu when we walk close to the side-door or the switch, allowing us to open or close the doors, or pull and push the switch. Note that no separate action is defined for either the main garage door or the radar, since the radar will be uncontrollable and the garage door will be controlled by the switch. | + | The UserAction class defines how the player interacts with the animations. We basically want an action appearing on the action menu when we walk close to the side-door or the switch, allowing us to open or close the doors, or pull and push the switch. Note that no separate action is defined for either the main garage door or the radar, since the radar will be uncontrollable and the garage door will be controlled by the switch. |
- | Lets look at the first class; it is the command for opening the side door (OpenSideDoor). Its display (which shows in the ingame menu) is "Open door2" | + | Lets look at the first class; it is the command for opening the side door (OpenSideDoor). Its display (which shows in the ingame menu) is "Open door2" |
- | Also, you see the switch`s statements fields are also controlling the main garage door animation by adding a second "this anim...." | + | Also, you see the switch`s statements fields are also controlling the main garage door animation by adding a second "this anim...." |
So that leaves us with a working side door, an animated switch that also operates the main garage door. But we need one more thing to get the radar animation to start. | So that leaves us with a working side door, an animated switch that also operates the main garage door. But we need one more thing to get the radar animation to start. | ||
- | {{ http://tactical.nekromantix.com/images/wiki/ | + | {{ https://pmc.editing.wiki/ |
//The Eventhandler class is a v1.85+ feature and is quite handy sometimes// | //The Eventhandler class is a v1.85+ feature and is quite handy sometimes// | ||
- | The eventhandler is a nice addition to OFP and a small revolution on its own. Basically it checks if certain " | + | The eventhandler is a nice addition to OFP and a small revolution on its own. Basically it checks if certain " |
- | This is done with filling out the init-field with the rather strange-looking variant of the "this animate[" | + | This is done with filling out the init-field with the rather strange-looking variant of the "this animate[" |
- | OK, that was the configfile and a bit info about animations. Hope you learned some of it and maybe can use this information on your own addons soon. Lets get this structure ingame and see how it all looks like! | + | OK, that was the configfile and a bit info about animations. Hope you learned some of it and maybe can use this information on your own addons soon. Lets get this structure ingame and see how it all looks like! |
Next! | Next! | ||
Line 200: | Line 207: | ||
====== Ingame testing ====== | ====== Ingame testing ====== | ||
- | Ok, time to test it ingame. Make sure all steps are completed right and compile the file the usual way, naming it firstanim.pbo. Its under Objects-> | + | Ok, time to test it ingame. Make sure all steps are completed right and compile the file the usual way, naming it firstanim.pbo. Its under Objects-> |
Walk up to the console and try the garage and switch animation to see if they work OK. Then make sure the side door works and that the fake linear animation trick works nice. Also, the radar should be spinning strait away. If all that seems OK, then congratulations :). If one of more of the doors seem to rotate wrong (maybe the side_door sliding the other direction), then go back in the p3d and reverse the axis (or switch the +/- signs in front of the angle1 setting for the offending animation) | Walk up to the console and try the garage and switch animation to see if they work OK. Then make sure the side door works and that the fake linear animation trick works nice. Also, the radar should be spinning strait away. If all that seems OK, then congratulations :). If one of more of the doors seem to rotate wrong (maybe the side_door sliding the other direction), then go back in the p3d and reverse the axis (or switch the +/- signs in front of the angle1 setting for the offending animation) | ||
- | {{ http://tactical.nekromantix.com/images/wiki/ | + | {{ https://pmc.editing.wiki/ |
//The garage can fit a small car with no problem. Notice the Door2 action appearing on the menu.// | //The garage can fit a small car with no problem. Notice the Door2 action appearing on the menu.// | ||
- | {{ http://tactical.nekromantix.com/images/wiki/ | + | {{ https://pmc.editing.wiki/ |
//The side door " | //The side door " | ||
- | {{ http://tactical.nekromantix.com/images/wiki/ | + | {{ https://pmc.editing.wiki/ |
//..and the door moves then you pull the switch as it should do. Nice :)// | //..and the door moves then you pull the switch as it should do. Nice :)// | ||
- | Well, hope you liked the tutorial. You can get the final working PBO [[http:// | + | Well, hope you liked the tutorial. You can get the final working PBO Brsseb_lesson9_done.rar |
- | Cheers! | + | Cheers! |
Next! | Next! | ||
+ | |||
+ | **Download** OFP.Brsseb_Lesson/ | ||
+ | < | ||
+ | magnet:? | ||
+ | </ | ||
+ | |||
====== Notes ====== | ====== Notes ====== | ||
- | This tutorial was written by Brsseb in [[http:// | + | This tutorial was written by Brsseb in [[http:// |
ofp/modeling/brsseb_lesson9.1223280605.txt.gz · Last modified: 2008/10/06 08:10 (external edit)