# Tutorial-4 Aeroplane

This tutorial shows how to apply the practices learnt in earlier ones on this page, for example, to an aeroplane instead of road vehicles. Here is the aeroplane taking off from a wet runway with a bit of right rudder to counteract the engine torque and prop wash over the tail fin:

Now that we are going to change the path curve from essentially flat to definitely three dimensional, we find a new issue to contend with. When you assign the curve modifier to the fix and target planes, you may well notice that they do not stay level, this is because the vertices of the curve acquire a twist as you move them up and down, or rotate them in the various planes. This can be corrected by one of two means, the first is to “tilt” the vertices in Edit Mode. This involves using the Tilt command as found in the tool shelf below:

The other way is to change the Armature slightly, if you use Track To constraints, rather than Damped Track Constraints, you can force a bone to remain upright whilst tracking towards the target object, by setting the Up axis.

In the image above you can see I have two target empties, one is parented to the fix plane and one to the target plane, although it is in front of it. The root bone has a Track To constraint to the empty parented to the fix plane, this allows me to keep it perfectly upright all the time as the curve twists. The steer-track bone has a Track To constraint with the other empty, parented to the target plane, as the target object. We can then use the difference in rotation of these two bones to determine, if the aeroplane is going around a corner, or not, exactly as we did in the previous tutorials for cars, trucks and bikes.

Here is the aeroplane landing in the wet, not too much braking Biggles:

The near vertical bone in the setup image is the plane bone. This is parented to the root bone and has two main functions; to roll the aeroplane in corners and to pitch the aeroplane for takeoff and landing, etc. We could also use it to yaw the aeroplane as well, if the plane was laying off for wind drift (pilot’s jargon). I have set a driver on the X axis of this bone to roll the aeroplane, much as I used the same principles to lean the bike, the driver value is:

var * 2.1 where var is the X rotation of the steer-track bone in Local Space.

You must experiment with the driver to get the right degree of roll for the amount of turn. I have used my Speed & Acceleration node to determine the speed of the aeroplane at any point during its flight. This enables me to keep the speed constant once the aircraft is in the air and before it lands. I also use nodes to rotate the propeller, I base the rotation on the forward movement of the fix plane, but I want it to start before the aeroplane starts to move and after it has stopped. Here is the node tree:

There is quite a lot going on there, I will deal with it in sections. My Speed & Acceleration node required three inputs; the location of the object on the current frame, its location on the previous frame and also the same for the frame before that. This gives us three locations, from which the node derives two speeds and therefore also the acceleration of the object. I am only interested in the speed, which I have divided by the frame rate to get units per frame – 0.86 approx = 74Km/h – about right for the aeroplane model. This value I use to work out what offsets to use for the fix object to get the speeds I require.

You can see I use two Object Transform Inputs nodes set at -20 and 20 to get the propeller rotation, that is the prop starts to turn 20 frames before the aeroplane moves and for 20 frames after it stops. theses are conventional nodes, just look in the Advanced Settings for the node.

There is also an Expression node to work out, based on the current speed and frame offset, what the next keyframe should be. So I have asked it to give me the offset after 140 frames from the previous keyframe – the output is given as around 86.9. The previous keyframed position was x = 10 so the next one after a further 140 frames will be 96.9. I also scaled the keyframe handles for the points at the start and end of the constant speed section to 0 so the curve in between is a straight line, so at a constant speed:

It is worth noting that you can use Expression nodes as useful calculators, just feed the variables and enter a formula, no need to get your calculator out! if you don’t have a brilliant (Ha Ha) node like my Speed & Acceleration node, you have to do all this the long complicated way, by working out offsets per frame and lots of maths.

Here is the aeroplane in mid-flight executing a cat 1 left turn – 10 degrees bank angle and a 180 degree turn should take 60 seconds at this bank angle, can’t you tell I fly aeroplanes, here is the aeroplane in the turn:

Note the motion blur on the prop and the lack of pilot, I must get around to adding drivers, riders and pilots to my models at some stage, maybe I will put Erkinator in the aeroplane, or on the bike, he would like the bike I think.

Here is the inevitable short video:

The camera is in a fixed position with a Track To constraint targeted on the fix object. I have keyframed some variations of the camera’s focal length along the way so the plane does not get too big, or too small in the field of view. The model is just a simple mesh using large polys, a Sub-Surface modifier and a Mirror modifier.

Afterthought:

A good way to see the twist of the vertices on your curve is to give it an Extrude Value – I have used 0.2 here. If your vertices are all correct, the extrude will be along the vertical plane, this shows up nicely when you tilt them, then get rid of the extrude value when you are done.