MOHO PRO 14 Physics Pendulum Tutorial

So far, the Golden Dragon has dealt with deep topics only. Today I want to shift gears a bit. I've been learning 2D animation and I noticed there wasn't a tutorial for something I wanted to do for a personal project: A Physics-based Pendulum. After some hours of testing, I inferred how to do it myself. I recently produced a video tutorial on how to do it.

This article is the text-based companion to the video tutorial. It assumes you are somewhat familiar with creating simple shapes and bones in MOHO. Here we go. How to make a Physics-based Pendulum in MOHO PRO 14.

Traditional Physics

Most tutorials (including the MOHO 14 tutorial manual) showcase physics with roughly these instructions:

  1. Draw a couple of shapes, each in a vector layer. A perfect circle and a ramp work great for the showcase
  2. Group them both...
    1. Select them
    2. Right click
    3. Choose Group with Selection
  3. Enable physics for the shapes...
    1. Double-click the group
    2. In the Layer Settings window (that just opened up), navigate to the Physics tab
    3. Check the Enable Physics (animated) checkbox
  4. Make the ramp immovable...
    1. Double-click the vector layer with the ramp
    2. In the Layer Settings window (that just opened up), navigate to the Physics tab
    3. Check the Non-moving object checkbox

If the circle (aka. ball) is over the ramp (an immovable object), MOHO will automatically animate as if there was gravity in the scene. But what if you want to create something more complex like an object hanging from a rope? Like a pendulum, for example. We must use a bone layer along with the physics group for that. Let's see how that's done.

Layer Setup

In your project, create the following layers and groups in the Layers window (found at the bottom right of the screen):

  • Physics (Group required to enable physics)
    • Bones (Bone layer required to connect all parts of the pendulum)
      • Ball (Vector layer)
      • Ceiling (Vector layer)
      • Rope (Group for all elements of the rope; this is not required for the animation but is good for organizing the layers)
        • Rope 4 (Vector layer)
        • Rope 3 (Vector layer)
        • Rope 2 (Vector layer)
        • Rope 1 (Vector layer)

It should look like this in the software...

Layers for this tutorial as shown inside MOHO

Drawing Shapes

Let's draw each vector shape! All the required shapes can easily be created using the Draw Shape tool. Type s on your keyboard (while on frame 0) as a shortcut to select the Draw Shape tool.

The Draw Shape tool ready to draw a rectangle, as shown in MOHO

Select each respective vector layer while drawing...

  • A rectangle for the ceiling
  • An oval for each of the 4 rope segments
  • A circle for the pendulum's ball

Remember to select the appropriate shape from the Draw Shape tool each time. You should end up with something like this.

The pendulum drawn for this tutorial

Adding Bones

Moving on, let's add the bones.

  1. Make sure you are on frame 0
  2. Select the bone layer (we named it Bones in our example above)
  3. Click a on your keyboard as a shortcut to select the Add Bone tool
  4. Click once on the center of the ceiling's rectangle to add its pin-bone
  5. Click and drag from top to bottom for each of the rope segments
  6. Click once on the center of the ball's circle to add its pinbone

The sequence used to add the bones is of critical importance. If you first add the ball's pin bone, then the parenthood of the bones will most likely be incorrect and the animation won't play out as you expect.

You can click p on your keyboard to see the parent relationship between bones (with the Reparent Bone tool). You can also use this tool to fix any mistakes you may have made. Each bone should parent the bone below it. Your bones should look like this when inspected with the Reparent Bone tool.

The correct bone parenthood

You must also bind each bone to its respective layer.

  1. Make sure you are on frame 0
  2. For each vector layer with a shape...
    1. Select the vector layer with a shape
    2. Select the Bind Layer tool (on the left)
    3. Click the bone you want to bind it to

You can use the following image as a reference.

The Ball layer with its pin-bone bound (highlighted in red)

Enabling Physics

Next, let's enable the physics.

  1. Enable physics for the shapes...
    1. Double-click the group
    2. In the Layer Settings window (that just opened up), navigate to the Physics tab
    3. Check the Enable Physics (animated) checkbox
  2. Make the ceiling immovable...
    1. Double-click the vector layer with the ceiling
    2. In the Layer Settings window (that just opened up), navigate to the Physics tab
    3. Check the Non-moving object checkbox

Problem Showcase

Since we added and bound the bones, we can move the pendulum in frame 0 (with the Manipulate Bones tool). But if we run the animation now, nothing will happen. However, you'll notice that keyframes will be added to the timeline in the bone layer.

Why does this happen?
The problem here is we drew the pendulum in a position where physics won't move the object further. If we want to see movement, we need the ball to be moved to the right (or left) a bit. Unfortunately, we can't move physics objects directly. And redrawing and rebinding everything every time we want to test a new starting position is too inconvenient. So what could be done? We can enable physics only after some time has passed.

Physics Timeline

To enable physics only after some time has passed...

  1. Make sure you are on frame 0
  2. Make sure you are selecting the Physics group
  3. Disable physics for the shapes...
    1. Double-click the group
    2. In the Layer Settings window (that just opened up), navigate to the Physics tab
    3. Uncheck the Enable Physics (animated) checkbox
  4. Move the cursor in the timeline to second 2 (for example)
  5. Reenable the physics for the shapes. The timeline will show a green line to signify when the physics will be enabled.

It's even possible to disable the physics mid-animation. If you want to do this...

  1. Move the cursor in the timeline to second 8 (for example)
  2. Disable the physics for the shapes.

If you've followed the previous steps, your Physics group timeline should look like this:

The physics timeline showing when the physics will be enabled (with a green line)

Manipulating Pendulum

Before moving the pendulum, I recommend lowering the bone strength a bit. The bleed strength between bones can make the animation look weird. But you shouldn't disable the bone strength entirely. Otherwise, the parts of the pendulum will simply fall in the direction of gravity.

To lower the bone strength...

  1. Make sure you are on frame 0
  2. Select the bone layer (named Bones in our previous example)
  3. Click s on your keyboard as a shortcut to select the Bone Strength tool
  4. Click and drag to the center of each bone.
The bone strength of each bone of the pendulum

Now that physics will kick in until second 2, we can manipulate the pendulum like a normal shape in the first few frames of the animation. Let's skew the pendulum a bit to the right.

  1. Select the bone layer (named Bones in our previous example)
  2. Position the cursor on frame 1 (or higher)...
    1. Hold down Alt (on Windows) or Option (on MacOS, I think)
    2. Place your mouse cursor on the timeline, at the bottom of the screen
    3. Move the mouse scroll wheel down once
  3. Skew the pendulum to the right...
    1. Press z as a shortcut to select the Mainpulate Bones tool
    2. Click and drag the rope segment bone that is closest to the ball
The pendulum in a skewed position, ready to swing downwards

If you now let the animation play out, it should show you the pendulum oscillating as you would expect. And it even stops moving once the physics are disabled on second 8. Yippee! :D

There are a couple of important things to note. Let's cover those next.

  1. For your vector layers inside a bone layer to show the Physics tab in the Layer Settings, you need to bind them to a bone first. If you don't know this beforehand, it may lead to a very confusing situation. If you can't see the Physics tab in your vector layers, this is most likely the reason why.
  2. If you hide the ceiling, the pendulum will simply fall. For Moho, hiding the ceiling is making it non-existent. If you need the ceiling not to show, you must remove the shape's fill and stroke instead. The animation will work the same if you do this.
  3. Finally, note that you can't animate with the Non-moving object checkbox. This means you can't use this to make the ceiling and pendulum drop all of a sudden. If you try this, you'll get a keyframe in the timeline but the animation will play out the same.

Thank you for reading today's tutorial! As always, If you find my articles valuable and you'd like to support me, you can do so by...

Thank you and have a great week ahead!