Lesson 5 - Your First Animation
When creating your first animation it is important to start with the simple before working your way up to more complex challenges.
For this section of the tutorial series, I have created a very crude airplane model so that we are all looking at and using the same example. But by all means, if you prefer to use a model of your own, feel free to do so. The main idea with these next few lessons is to show the fundamental techniques and some of the basic animations that we have at our fingertips in YSFlight. This model serves that purpose.
For your first animation we will animate the flaps. Following the best practices from the previous lesson lets first outline the plan.
- The flaps will be split into separate components named "l_flap" and "r_flap". This requires the mirror modifier to be accepted and some separation on your part.
- The object center will be placed at the upper inboard vertex as shown in the image below and on the right.
Selecting vertex to place object center.
Inserting an empty co-located with the new object center.
The temporary empty is inserted to serve as a place-holder for easy replacement after rigging the flap.
Rigging The Flap Mesh
Rigging a component for animation is a fairly straight-forward process. Complicates arise when angles, and multiple components are involved to build a family tree of components for more complex animations. For your first rigging, this component was specifically made to be the ideal situation. Other parts of this model will introduce you to some of the wrinkles and challenges you will encounter.
Moving to Isolated View Mode
Select the right flap object and press the / key on the number-pad to move the object to the local view. Add in an empty and move both items to the origin. I like to use the Snap-To-Cursor function and use ctrl+c to move the cursor to the origin.
This is perhaps the most critical part of rigging a component for rotation. The end result of this animation will be a rotation about the y-axis. Therefore we need to make sure that the y-axis aligns with the desired points of the mesh.
Top-down view to make sure the flap doesn't need any rotation about the z-axis to make sure the mesh is aligned with the global y-axis.
Front view to make sure the flap doesn't need any rotation about the x-axis to make sure the mesh is aligned with the global y-axis.
In this case, there are no rotations needed so we can proceed to creating the parent-child relationship. Select the flap then the empty. Press CTRL+P to create the parent-child relationship. At this point, name the empty to something indicating what it is. I chose "r_flap_e".
Now that the right flap is rigged it needs to be placed into its original position. Dis-engaged the local view by pressing the / button the number-pad again. Select the original temporary empty, snap the cursor to it and then delete it. Snap the f_flap_e to the cursor to finally reposition it.
Prepping Blender for Animations
Now that the right flap is rigged we can animate it. To begin we must activate the YS Paint Scripts.
- In the Scripts Window, select DNM View. (Scripts -> Object -> DNM View)
- In the 3D view window, activate the show_object.py space handler script. (View -> Space Handler Scripts -> Event: show_object.py) NOTE: You may see 2 other scripts here. You only need to select the show_object script. If an object has a CLA applied, this script will make the CLA appear in the DNM View script window when selecting the object in the 3D View window. In addition, this script makes tagging objects with a CLA possible. If this script de-activates you may find that your CLAs are not sticking to the objects. One thing to watch out for is when selecting an animated object the Frame you are looking at will reset to 1.
First we will assign the CLA. Select the right flap object in the 3D view window. In the DNM View window, you can select the animation from the drop-down list (as shown below) or by clicking the left and right buttons in the CLA box.
The second step is to apply the STAs. Refer to the YSFlight Wiki page for the order in which STAs need to be defined. For flaps, we need 2 STAs. The first is for Flaps Up, while the second is for Flaps fully deployed.
In Blender we will insert a Key to define each STA. I always make my Keys 10 frames apart. This gives me the opportunity to see how they will move in-game while sill in Blender.
Use the Up or Down arrow keys to jump up or down 10 frames until you find a frame you want to start with. With the right Flap selected, press I. This opens the Insert Key menu as shown below.
For YSFlight we can only manipulate the object position (Loc), rotation (Rot), or visibility (Layer). Sometimes we will want to define something that will rotate and move at the same time (LocRot).
- For this first animation, we are just going to do a Rotation (Rot) animation, so you need to select Rot from the Insert Key menu.
- Jump 10 frames forward (i.e. if you started at frame 1, move to frame 11).
- Rotate the flap to the desired angle. I chose 40 degrees. Note that this can be done with the Transform Properties window or by doing a y-axis rotation (r -> y -> -40 -> RETURN)
- Open the Insert Key menu again and insert another Rot key frame.
This animation is now complete! Congratulations on making your first animation.
If you setup your Blender User Interface as shown in Lesson 1, the IPO Curve Editor window will now show the animation assigned to the flap (when the flap is selected). Each line shows the value of the x,y,z rotation as the over the 10 frames the animation is defined in within Blender.
Okay, it is now time for you to practice this on your own. Using what you have learned in this lesson, animate the left flap so that both flaps move at the same time in Blender.