Rotating-object Tutorial


This tutorial describes how to build an animated object for Twinity. We will build a simple Mobile, animate it and prepare to upload it to Twinity.

What you will need

  • A 3D Modelling Software. For this tutorial I have used 3D Studio Max. Install the ColladaMax export plugin which you can find in the Download section.
  • Free tools such as Blender or Google SketchUp are also available in the Download section.
  • A graphics editing program like Photoshop or Gimp. GIMP is available in the Download section.
  • A simple text editor like the Windows "Notepad"

Create the basic Model

Lets start with modeling the Mobile, as shown in the picture below.
As basis we take a simple "Box" and name it bottom. For the axis and the top, we take two "Cylinders". Convert the axis-cylinder to an "Editable Poly"-object and attach the top to this object. We name this new poly-object rotating. Place four "Spheres" under the top and as connection to the top four "Cylinders". Name the spheres ball1 to ball4 and the cylinders for the connection string1 to string4.

example model

After the basic model is finished, we create a simple texture for the Mobile. Open the "Material Editor". Rename the first Standard material to mobile_mat and change the "Diffuse Color" to a light yellow. Now select all parts of Mobile and assign the mobile_mat to them.

create a simple material

Create the Controllers and skin the model parts to it

For Twinity it is important that animated objects are skinned to control-structures like "Bones". In this part of the tutorial we will set up this control structure, by using "Dummy"-objects.

First we hide all parts of the Mobile except the bottom-box. Then we create a new "Dummy"-object and move it to x=0, y=0, z=0 and name it static. You find the "Dummy"-object at the "Create-Command-Panel" under "Helpers".

Create Command Panel create a dummy-object

Now we select our bottom-object and go to the "Modify-Panel". Add a "Skin"-Modifier from the drop-down "Modifier list" to it. Click the Add-Button in the "Parameters Rollout" and add the static-dummy to it. Our bottom-box is now completely skinned to the static-dummy. As a test, we can move the static-dummy, the bottom-box will follow the dummy now.

skin the bottom to the static-dummy

The rigid part of our Mobile is skinned now. Hide the two objects bottom and static. Next, we will create the controls for the movable parts.

Unhide the rotating-object and ball1 to ball4. Now we create a new Dummy at x=0, y=0, z=0 and name him rotor. This is our main control for the rotation. The balls will join the rotation of the rotating-object, but also be moved by the centrifugal force to the outside. So we have to create four "Dummies", one for each ball and name them ball1_controller to ball4_controller. Place them to the middle of each ball.

skin the bottom to the static-dummy

Select all ball_controller and link them to the rotor by using the "Select and Link"-tool. The ball_controllers will follow the movement of the rotor now.

link the ball_controller to the rotor

Next, we have to skin the rotating-object to the rotor and each ball to its respective ball_controller. For this we proceed the same way as we have done it before with the bottom-box. We add a "Skin Modifier" to the rotating-object and at the "Parameters Rollout" of the modifier we add the controller rotor. Do the same with each ball and its controller.

skin the rotating-object to the rotor-controller skin the ball-objects to the ball-controller

So far so good, only the four connections between the top of the Mobile and the balls are not skinned yet. This will be our next step.
The upper verticies of the strings are connected to the top of the Mobile and the lower ones are connected to the balls. So we have to skin the each string to the rotor AND the respective ball_controller.

Hide the balls and the rotating-object and unhide the 4 string-objects. Select string1 and add the "Skin Modifier" to it. In the "Parameters Rollout" add the rotor AND the ball1_controller.

skin the string-object to the ball-controller and the rotor

Now we have to specify which verticies are affected from which controller. Click on "Edit Envelopes" at the "Parameters Rollout", click on "Verticies" at the "Select Section" and then click on the ball1_controller in the "Bones list".

click "edit envelopes" and pick the ball_cotroller select the lower verticies

Select the lower verticies of the string1-object and go to the Parameters Rollout at the section "Weight Properties". Set "Abs. Effect" to 1.0 so all selected verticies will completely affected by the ball1_controller and will displayed red in the viewport.

set "Abs. Effect" to 1.0

Select the upper verticies, go to Parameters Rollout and select the rotor from the Bones list and set the Absolute Effect to 1. The string1-object is skinned now to 2 different controller. Do the same with the other string-objects. Keep in mind that all verticies of an object have to be skinned to a controller.

Animate the Mobile

After the Skinning is finished, we can start to animate our Mobile. Lets check the timeline under the the viewport. They should start at 0 and go up to 100 frames. You can adjust the settings by clicking the Time Configuration-button shown in the picture below.


Unhide all objects and controller and select the rotor. Move the Timeslider to frame 100 and click Auto Key on. Rotate the rotor controller 360 degrees around the z-axis. At the timeline you can see there are two new keys, one key at frame 0 and the other at frame 100.

animate the rotation of the Mobile

Now we want animate the ball-objects. Move the Timeslider to frame 50 and go to the Topview. Auto Key is still on, so now we can move each ball_controller away from the center. If you move one controller the ball and a part of the string will follow him.

animate the ball_controller

Select all four ball_controller, go to the Frontview and move them a bit down closer to the ground.

animate the ball_controller

Switch Auto Key off and play the animation. As desired, the Mobile rotates around its own axis. The balls are moving away from the center, but then they remain in this position and don't return back to the starting position. To fix this we have copy the keys from frame 0 to frame 100. Select all ball_controller and select all keys at frame 0. Now press and hold the SHIFT-Key and move the selected keys with the mouse to frame 100.

select all ball_cotroller and then all keys at frame 0 press and hold SHIFT and copy the keys to frame 100

Play the animation again. Now the balls returns back to their starting position and we have a nice looping animation.


All parts of our Mobile are skinned now and the movable parts are animated. So we are ready to export our Mobile to a COLLADA-file. Unhide all parts of the mobile and all controller, click in the main menu File --> Export, choose the filetype COLLADA (*.DAE) and export your Object.

export dialog

Twml options

The next step is to create the TWML-file. The example uses the following attributes:

  • caption: Name of the action as it shows up in the client context menu
  • trigger: Event that triggers the animation, in this case the member needs to click on the object to start/stop the animation
  • path: Path to the Collada file containing the animation

Twml example

<package caption="Rotation Object" icon="icon.jpg">
    <description>Animated Rotation Object</description>
    <object path="rotating-object.dae">
        <action caption="Rotation Object" trigger="click">
            <object_animation path="rotating-object.dae"/>