Table of Contents

Lesson 6: Creating your first Airplane

Creating your first Airplane by Brsseb

Preparing for the lesson

Yes, now im back and its finally time for airplanes! First things first..you need these skills and programs to do this tutorial:

There is already a good Airplane tutorial on the net (Building the Piper Cheyenne). Its not done yet and it focuses on modeling an airplane from start to finish (from blueprint setup to final model). In my tut, which will be a abit shorter, I will focus just on the LOD (and config) setup needed to get an airplane model working properly in OFP.

Ok, lets move to next page and have a look at the tutorial model…(drumroll…)

The tutorial model

Ok, i know that if you have followed the other tutorials, you know that I don't make proper models for my tuts. I make them as simple as possible so that its easier to see i.e important vertex placements on my screen shots (hard to understand a 3d mesh view with 2000+faces in the background…) and for the fact that I don't want to use too much time on simple example models. So here it is, in all its glory:

pmc.editing.wiki_images_brsseb_brsseb_lesson6_b_1.jpg The model we will we working with in this tutorial

First thing you must do is download the model.You can get the ZIP Brsseb_lesson6_start.rar from bottom of this page.

As usual, extract the ZIP and put the folder you get in your bulldozer directory just as any other addon project. The folder is called “firstplane”. The p3d is also called “firstplane”, then there is a config.cpp file and some basic textures.

pmc.editing.wiki_images_brsseb_brsseb_lesson6_b_2.jpg Fire Geometry and Geometry LOD looks like this

Since we have learned many things by now, I have made the most obvious things on the model. Here Fire Geo and Geo are the same (just that Geo has wheight, of course). On a real project, Fire geometry would usually be mode detailed.

pmc.editing.wiki_images_brsseb_brsseb_lesson6_b_3.jpg Landcontact contains just 3 vertices making up the trycycle landinggear

The landContact LOD contains just 3 vertices, each repersenting the though point for the wheels. We will have to change this one later for the gear to work properly, though.

pmc.editing.wiki_images_brsseb_brsseb_lesson6_b_4.jpg Nothing new in memory LOD yet, just the basics of any vehicle

And then the Memory LOD, containing things that you learned ages ago, right? Hope so.

So, so lets not go into o2 just yet. I want to show you what we need to do. The easiest way to explain the work needed; I want to you to compile the firsplane now. Yes, test it ingame and see what we need to do! Start your PBO program, compile the firstplane folder and put the resulting pbo in your addons folder. Yes it will fly! (but dont use the firstperson view for the pilot/cargo, since the View Pilot/Cargo LODs are not made yet, we`ll do that last (since we will be editing the original “0.00” LOD all the way).

pmc.editing.wiki_images_brsseb_brsseb_lesson6_b_5.jpg

pmc.editing.wiki_images_brsseb_brsseb_lesson6_b_6.jpg The plane it its current state. Not very plane-ish, am I right? Note that the landinggear dont retract, the rotors dont spin and there are no control surfaces (flaps, rudder, ailerons) present. Dont worry, we`ll fix all that!

Ok, so not much to brag about is it? No working gear animation, the rotors don't spin or anything. And there are no working flaps, rudder or ailerons to see. But it can take off, land, and it flies very well. That's due to the config file, and we can make ANYTHING fly with just the right configfile. So no magic really.

Ready to fix the plane? Then start up o2 and bulldozer and move to the next step.

Making the landing gear work

Lets fix the landing gear first. If you tested the model ingame, you will notice that the Raise/Lower landing gear at the action menu works. Trying to land the plane without gear down, you will crash. So that's not the problem, that's all defined in the config. What we need to do is make the animation for our gear work so that the gear in the plane retracts and lowers when the user uses the aciton menu.

How do we do that, you say? If you have followed my tuts you know it by now: we set up a bunch of wacky named (in czech) selections and let the ofp engine do the rest. We have a tricycle landing gear (one nose gear and two at the rear), just like the ofp A10 got. So ofp will have no problem with this.

pmc.editing.wiki_images_brsseb_brsseb_lesson6_c_1.jpg

pmc.editing.wiki_images_brsseb_brsseb_lesson6_c_2.jpg

pmc.editing.wiki_images_brsseb_brsseb_lesson6_c_3.jpg

Ok, now ofp know what the gears are and will use these selection when doing the rotation. But we still have work to do, we need to define an axis for each wheel, so that ofp can rotate each wheel around. Lets go to memory lod for that:

pmc.editing.wiki_images_brsseb_brsseb_lesson6_c_4.jpg

pmc.editing.wiki_images_brsseb_brsseb_lesson6_c_5.jpg

pmc.editing.wiki_images_brsseb_brsseb_lesson6_c_6.jpg

Ok, so now OFP can do the gear animation with no problems. One thing remains though:

pmc.editing.wiki_images_brsseb_brsseb_lesson6_c_7.jpg This way the LandContact points follow the gear animation

Guess what, if you have checked that all selections are named right and you have followed this page to the point, the gear should work now. So compile and lets test the gear ingame. If some of the gears don't work, its probably because a bad named selection. Make sure you got no typos on the plane. And should some animation work the wrong way, try rotating the axis 180 degrees in Memory LOD.

Note that we cant seem to control the direction the gear retracts. They always retract forward, like the A10 does, and sometimes that's not what we want (e.i. most ww2 fighter retracted their gear inwards). So if we want to have a different gear animation, we can (from v1.85+ at least). But this is out of scope for this simple tutorial.

ok, now lets see if we can do anything about the static rotors. Lets make them spin!

Fixing the rotors

Lets make the rotors turn. The LOD setup for that is similar to the one from lesson 4, where we made teh rotor blades spin. We need some selections in 0.00 lod and some axises in Memory lod. Note that we have two engines on this plane, so if you just have one engine, you just use the first set of selections.

Note that both engines has a rotor structure and a face with a rotor blur on it. Lets begin.

pmc.editing.wiki_images_brsseb_brsseb_lesson6_d_1.jpg

pmc.editing.wiki_images_brsseb_brsseb_lesson6_d_2.jpg

pmc.editing.wiki_images_brsseb_brsseb_lesson6_d_3.jpg

pmc.editing.wiki_images_brsseb_brsseb_lesson6_d_4.jpg

Ok, done with the rotors in model lod. Lets head for Memory LOD and make the axises for the spinning rotors.

pmc.editing.wiki_images_brsseb_brsseb_lesson6_d_5.jpg

And that's that. Compile and see how it looks ingame. Make sure you got all the selections correct or you might get some strange results.

pmc.editing.wiki_images_brsseb_brsseb_lesson6_d_6.jpg Plane with working rotors. Nice!

If you only had like 1 rotor, you simply do the same setup without the one engine included, and that way you could also leave out the “0” in all selections that have that.

Now, how about fixing those control surfaces, eh?

Control surfaces

Lets make one type of control surface at a time and then compile and test to see if it works.

The rudder

We`ll start with the rudder. As you can see we need only one rudder surface, since we have only one vertical tailfin. We must make the surface, give it a selection name and an axis.

pmc.editing.wiki_images_brsseb_brsseb_lesson6_e_1.jpg

Go to memory LOD and create an axis for the rudder. Name it “osa leve smerovky” (axis left rudder)

pmc.editing.wiki_images_brsseb_brsseb_lesson6_e_2.jpg

Now lets compile and see if it works. I assume you know how rudder should work (which way it turns when you turn the plane). If not, consult any flight simulator or check out the official planes. The problem when making axises for plane surfaces, is that the order the vertices in the axis is created matters! So sometimes you might end up with a surface, like the rudder, going the wrong way or spinning around like crazy. If the rudder is reversed when you compile now, simply swap the axis vertices position to fix it (that way you have rotated the axis 180* and it should now work). The axis swapping need is a common problem with plane makers, so be prepared to swap some axis points if the problem occurs.

pmc.editing.wiki_images_brsseb_brsseb_lesson6_e_3.jpg How the rudder should work. If it is reversed, try swapping the two axis points

The most common problem with plane surfaces is Typos, its so damn easy to make a mistake when typing the selection names (much due to the words left and right in Czech has different forms; levy (left); leve, leva, and pravy; (right) prave, prava, etc. So make sure you get all of the selection names right!

The elevator surfaces

Go to 0.00 lod and make the two missing elevator surfaces. (place a box-structure, resize and make them black like before). Then select each of them and name them “leva vejskovka” (left) and “prava vejskovka” (right). Note that its “pravA/levA”, with A instead of “Y” on the end. That's the most common Typos there is in plane making, thrust me! Make sure to get the right form on all words!

pmc.editing.wiki_images_brsseb_brsseb_lesson6_e_4.jpg

pmc.editing.wiki_images_brsseb_brsseb_lesson6_e_5.jpg

Now compile and test it ingame. Remember to swap (switch places) on axis vertices if one of the elevators go the wrong way when testing. If you are unsure, compare to another plane or try thinking of what happens when a surface moves.

The ailerons

The next surfaces are the ailerons, they make the plane roll to the side. Also, in ofp, ailerons is also used for air brakes. We want air brakes too, so these surfaces are somewhat different.

Go to 0.00 lod and make the ailerons. But this time, make a total of 4 structures, not just one pair as before. Remember the air brake on the A10? Of not, test it now and try to imagine how they did it. Basically, they have slitted each aileron surface in two, so that when normal flying it works just as a normal ailerons, but when you brake (holding the back-key long enough), they split parts, with one part going up and one down to form the air brakes. Pretty neat, really.

pmc.editing.wiki_images_brsseb_brsseb_lesson6_e_6.jpg Here is a setup for air brakes from another model of mine. Just to show you how it all works. Don't worry, I`ll walk you trough the whole selection naming

So lets do this:

pmc.editing.wiki_images_brsseb_brsseb_lesson6_e_7.jpg

pmc.editing.wiki_images_brsseb_brsseb_lesson6_e_8.jpg

Now you have two ailerons, one right and one left both split on two halves. Now we must create proper selections for them.

pmc.editing.wiki_images_brsseb_brsseb_lesson6_e_9.jpg

pmc.editing.wiki_images_brsseb_brsseb_lesson6_e_10.jpg

Phew, now that was a bit hard, now wasn't it? Test it and correct with axis swapping or typo hunt if you screwed up. Make sure you get it right: When a plane bank (roll) to the left, the one on your left goes up and the one on the right goes down (seen from the back). And vice versa. Also, test the air brake feature: when you hold down the back-button for some time, the ailerons should split and the top pair goes up (+90 degrees up) and the bottom pair goes down (-90 degrees down). Compare with the A10 if you are still unsure.

pmc.editing.wiki_images_brsseb_brsseb_lesson6_e_11.jpg Here showing how ailerons with air brakes work

The flaps

One surface type left: the flaps, used for either giving the plane extra lift at takeoffs of for reducing airspeed at landings. Dead easy for you to make now if you have made it so far.

pmc.editing.wiki_images_brsseb_brsseb_lesson6_e_12.jpg

pmc.editing.wiki_images_brsseb_brsseb_lesson6_e_13.jpg

Now test the flaps ingame. Operate them using the action menu and make sure they move the right way. if not, you know what to do don't you ;)?

pmc.editing.wiki_images_brsseb_brsseb_lesson6_e_14.jpg Flaps in the up and down positions

Ok, still alive? Good, because we are all done with control surfaces! So now they work, the propeller spins and the gear retracts. Great job! On the next page we`ll add some more detail, and then its all done!

Adding detail

We got a nice plane right now, but we can still add some minor details to spice it up a bit. So lets add some features: If you did lesson 5, the boat tutorial, you know that lights are easy to make. We just add some named vertices in Memory lOD. So lets have red and green position lights on the wingtips and a flashing white one at the top of the tail, like most planes do (Or go mad and decorate the plane with lights like a crazy christmas three, your choice ;) ). And a bunch of other smaller details.

pmc.editing.wiki_images_brsseb_brsseb_lesson6_f_1.jpg

pmc.editing.wiki_images_brsseb_brsseb_lesson6_f_2.jpg

pmc.editing.wiki_images_brsseb_brsseb_lesson6_f_3.jpg

pmc.editing.wiki_images_brsseb_brsseb_lesson6_f_4.jpg

OK, that's enough detail for now, isn't it? One last thing…

The Configfile

As usual, I give a short overview of the configfile. Im not teaching C++, so don't ask me about what classes are or such questions. If you don't have a CLUE on what this config does, you need to hook up with someone who knows if you want your addon in the game.

pmc.editing.wiki_images_brsseb_brsseb_lesson6_g_1.jpg Part 1 of the configfile

In the first part, we have the usual declarations, the CfgPatches class and where out model is introduced to the game for the first time, and the CfgModel class where we specify which type of addon this will be and what subclasses we need.

pmc.editing.wiki_images_brsseb_brsseb_lesson6_g_2.jpg Part 2 of the configfile

The last part is the interesting one. Here, the usual stuff about any vehicles are defined. Many of the values in here should be familiar to you now (model, side, displayname). Note the value “gearRetracting=true” indicating that this plane has retracting gear, like the A10 does. The Cessna haven't. Then there is a lot of physics values that can be tweaked for the plane, like brake distance and control surface sensitivity. Note that no weapons are on board the plane right now (that's for another tutorial, for sure ;) ).

OK, bored now? Me too, lets compile and get this thing over with!

Finish line

OK lets get this over with quickly. The last thing to do is to make the “View Pilot” and “View Cargo” LODs, just like you did in lesson 4 and lesson 5. Easy, just right click “0.00” LOD, select duplicate twice. Change the two new LOD copies to View Pilot and View Cargo. Now the messed up 1st person view for the pilot is no more!. See lesson 4 (helitut) for more in deep info about view-lods.

pmc.editing.wiki_images_brsseb_brsseb_lesson6_h_1.jpg pmc.editing.wiki_images_brsseb_brsseb_lesson6_h_2.jpg The plane ingame! Pretty nice, huh?

Get final PBO Brsseb_lesson6_end.rar below.

So compile the plane for the last time, and check it out ingame. If all works as planned, feel proud. If not, try again, make yourself 200% sure that you don't have any typos or anything. If everything fails (or you spotted a bug in this tutorial, mail me at brsseb@hotmail.com).

Thanks for all nice feedback Ive gotten so far since Ive started this tutorial series! I`ll try to write as often as I can. Cheers!

BRSSEB

Download OFP.Brsseb_Lesson/ Torrent Magnet from below:

magnet:?xt=urn:btih:40aac3407210ddb8ffcee06cdb009c0b099ccdce&xt=urn:btmh:122046986f756bcebf9744dc9f81bc3fc736a54e164113ec62e18c827a4a06271364&dn=OFP.Brsseb_Lesson&tr=udp%3a%2f%2ftracker.opentrackr.org%3a1337%2fannounce&tr=udp%3a%2f%2ftracker.openbittorrent.com%3a6969%2fannounce

Notes

This tutorial was written by Brsseb in ofp.gamepark.cz/_hosted/brsseb/, it was posted here with his permissions, thank you Brsseb!