Creating Animated Objects with AC3D

	Revision History
		02/16/07	Added note about new versions.
		09/16/05	Initial Draft

Important: There are multiple versions of the AC3D plugin, AC3D, and these tutorials. Please consult the chart to make sure you have the right tools!

AC3DPluginTutorialNotes
4.0-6.02.xThis Tutorial (Old)Works with old versions of AC3D
6.1+3.xOther Tutorial (New)Provides visual editing of animation with preview

This tutorial is for the older version of the plugin. Use the newer tutorial for the newer versions of AC3D and the plugin.

AC3D is a low-cost easy-to-use 3D modeler; it represents one of many ways to make models for X-Plane 8. This tutorial describes how how to create an animated object for X-Plane 8 with AC3D.

What you need to do this tutorial:

Before you begin you will need the following:

  • AC3D 5.0 for Macintosh or Windows.
  • The AC3D X-Plane OBJ export plugin version 2.0.
  • X-Plane 820 or ObjView 2.0 if you want to preview your animation.

Please read the AC3D X-Plane export plugin README carefully for installation instructions.

This tutorial assumes you already know how to make non-animated objects in AC3D. See the AC3D export plugin README for more info.

Overview of the Process

The basic process will be:

  1. Building the basic Jetway Object
  2. Structuring the model for animation.
  3. Defining the Animation Actions
  4. Making the OBJ.
  5. Viewing the results.

Building the basic Jetway Object

First we must make our basic model. While you can make any kind of Jetway, for the purpose of this tutorial I recommend mirroring the (ugly) Jetway I have built, so that the animation commands work without modification.

1. Within AC3D, make six objects that form a jetway.

You will need six objects: four boxes and two cylinders. To set their locations, sizes and names, use the Size to and Move to fields on the left side of the AC3D screen and the object-name field at the bottom. You will want to be in "Object" selection mode (object button in the topleft) to do this. Set your objects up like this:

    NAME        TYPE            LOCATION        SIZE
    wall        Box             0.5 ,5,0        1,2,2
    circle1     Cylinder        2   ,5,0        2.5,2  ,2.5
    tunnel1     Box             7.25,5,0        9  ,2  ,2
    tunnel2     Box             8   ,5,0        9  ,2.1,2.1
    circle2     Cylinder        13  ,5,0        2.5,2.1,2.5
    cab         Box             14.5,5,0        1.5,2.1,2.5

When you're done the hierarchy window should look like this:

The Jetway itself should look like this:

If you don't want to build the object, here is a copy of the basic model: jetway_basic.ac.

2. Select all objects.
3. Click the 'Smooth' button.
4. Click the '1S' button.

This sets all models to "smooth shading" and 1-sided. We want smooth shading so the circles look curved and 1-sided for performance. Also, these are the default modes in X-Plane so it's a little faster to use them.

Structuring the model for animation.

Next we need to create a hierarchy within the objects; this hiearchy will be used to form the animation. In particular, when the Jetway extends, we want the cab to come with it. So we will form a hierarchy based on the way the parts would be attached in real life. You will need to be in object-selection mode for this.

5. Select all of the objects except for 'wall'.
6. Pick the 'make Animation Group' command from the 'Tools' menu.

The hierarchy will change so that all of the objects except for wall are in a group called "ANIMATION".

7. Select the 'circle2', 'tunnel2', and 'cab' objects.
8. Pick the 'make Animation Group' command from the 'Tools' menu.
9. Select the 'circle2' and 'cab' objects.
10. Pick the 'make Animation Group' command from the 'Tools' menu.

Now you will have three nested animation groups. Your hierarchy window should now look something like this:

What this means: we now have three separate places where we can add animations. The first animation will affect everything but 'wall' and will be used to make the jetway appear to rotate around the first circle. The second will affect tunnel2, cab and circle2, and will be used to make the jetway extend. The last animation affects only cirle3 and cab, and will be used to make the cab rotate.

(Note that circle3 turns with the cab. If you wanted to make the cab turn but circle3 stay stationary, you would only have 'cab' in the third animation group. You can make an animation group with only one object.)

Defining the Animation Actions

Now we need to define our animation actions. We cannot do this with AC3D; as of this writing it does not have an animation editor. To define animations, we add some text to each "ANIMATION" group.

11. Right Click (Windows) or Mouse-Wheel-Click (Mac) on the first 'ANIMATION' object and pick the 'Edit object data...' command from the popup menu.

This is where we will enter the animation data for the first animation group.

12. Enter the animation data for the first rotation.

Here is the data you will need:

TRANSLATE  2  0 0    2 0 0   0 0    none
ROTATE     0 -1 0   -90 90   -1 1   sim/joystick/yolk_roll_ratio
TRANSLATE -2  0 0   -2 0 0   0 0    none

Translate/rotate/translate? Here's what's going on: the rotate command always rotates around the point 0,0,0 in a model. Since we want to rotate the jetway around the center of the first circle, we need to move the origin over, rotate, and move it back. So we put translations around the rotations.

The first translation will move the X axis over 2 units. Note that we specify this translation for the start and end translation and we enter 0 0 none for the dataref. This means: always move the axis over 2 units.

We then rotate around the axis 0 -1 0 from -90 to 90 degrees as the dataref goes from -1 to 1. The dataref is sim/joystick/yolk_roll_ratio, which is the roll axis of the yoke. (That spelling mistake is intentional - the dataref actually has had the wrong name since X-Plane 670, but we haven't changed it to keep from breaking old plugins.) As the yoke goes from -1 to 1 (full left to full right) the jetway will swing a full -90 to 90 degrees.

The axis specification is a vector telling around what line we rotate. The rotation is counterclockwise around that axis. 0 -1 0 points straight down, so the joystick will rotate clockwise. (Since it is a counterclockwise rotation if you are upside down. Basically if you negate your axis you change from counterclockwise to clockwise.)

That's pretty complex. Here's the important things to remember:

  • Always use two TRANSLATE operations with fixed values to define the point around which you rotate.
  • Change the sign on your axis to change from clockwise to counterclockwise.

Important: while this tutorial only demonstrates animation of an object using X-Plane datarefs, there is no reason why you can't use datarefs created by a plugin instead. Plugins and animated objects together are a powerful combination; you can model an animated object and use a plugin to control how it moves. Simply create custom plugin datarefs (see the SDK guide for the programming), then use those datarefs in your object.

13. Right Click (Windows) or Mouse-Wheel-Click (Mac) on the second 'ANIMATION' object and pick the 'Edit object data...' command from the popup menu.
14. Enter the animation data for the translation.

Enter this data:

TRANSLATE 0 0 0    8 0 0    0 1   sim/flightmodel/engine/ENGN_thro[0]

This means: we will move the model to the right 0 units when the first engine throttle is at idle and 8 meters to the right when the engine is at full. (ENGN_thro is the engine throttle ratio from 0 to 1; the first engine is called "0".)

One thing to note: since this is a nested animation, this animation will actually move in the direction the tunnel points. If the jetway turns, the animation above turns this animation, so that the joystick extends in the direction it is pointing.

15. Right Click (Windows) or Mouse-Wheel-Click (Mac) on the third 'ANIMATION' object and pick the 'Edit object data...' command from the popup menu.
16. Enter the animation data for the rotation.

Here is the data for the third and final animation:

TRANSLATE  13  0 0   13 0 0    0 0 none
ROTATE      0 -1 0  -90  20   -1 1 sim/joystick/yolk_heading_ratio
TRANSLATE -13  0 0  -13 0 0    0 0 none

This is the same as the first rotation...we translate, rotate and translate so that we turn around the second circle and not around the point 0,0,0. This will rotate 90 degrees left to 20 degrees right based on the rudder pedal's yaw.

Note that the point we rotate around (13,0,0) is defined in terms of the coordinates of the 'circle2' object in the initial object. We don't need to worry about the circle's position when the joystick is extended (which could even be 21,0,0). Because this animation is nested inside the other two, this animation's location changes with the jetway so that the whole model works together.

When you are done you should have something liike this: jetway_animated.ac.

Making the OBJ.

The last step is to export the model.

17. Pick Export... from the file menu and choose X-Plane 8 Object File...

Save the object as "jetway.obj". AC3D will give you a warning about not having picked a texture. This is okay; when you make objects for real you will take the time to texture them.

AC3D should export a file like this: jetway.obj.

Viewing the results.

To view your results in ObjView, simply drag the object file into ObjView and hit the 'a' key to show animation. All parts will animate continuously to show the basic animation structure.

To view this object in X-Plane, we will replace the KSBD object.

18. Rename the file 'KSBD_example.obj'.
19. Replace the KSBD_example.obj from X-Plane with your new object.

X-Plane's KSBD_example.obj lives in Custom Scenery/Default Demo Area/Custom Objects.

20. Run X-Plane and place the plane in KSBD.

As you move the yoke you should see your object animate; it should look like this: jetway.mov.