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:
- Draw a couple of shapes, each in a vector layer. A perfect circle and a ramp work great for the showcase
- Group them both...
- Select them
- Right click
- Choose
Group with Selection
- Enable physics for the shapes...
- Double-click the group
- In the
Layer Settings
window (that just opened up), navigate to thePhysics
tab - Check the
Enable Physics (animated)
checkbox
- Make the ramp immovable...
- Double-click the vector layer with the ramp
- In the
Layer Settings
window (that just opened up), navigate to thePhysics
tab - 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)
- Bones (Bone layer required to connect all parts of the pendulum)
It should look like this in the software...
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.
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.
Adding Bones
Moving on, let's add the bones.
- Make sure you are on frame 0
- Select the bone layer (we named it
Bones
in our example above) - Click
a
on your keyboard as a shortcut to select theAdd Bone
tool - Click once on the center of the ceiling's rectangle to add its pin-bone
- Click and drag from top to bottom for each of the rope segments
- 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.
You must also bind each bone to its respective layer.
- Make sure you are on frame 0
- For each vector layer with a shape...
- Select the vector layer with a shape
- Select the
Bind Layer
tool (on the left) - Click the bone you want to bind it to
You can use the following image as a reference.
Enabling Physics
Next, let's enable the physics.
- Enable physics for the shapes...
- Double-click the group
- In the
Layer Settings
window (that just opened up), navigate to thePhysics
tab - Check the
Enable Physics (animated)
checkbox
- Make the ceiling immovable...
- Double-click the vector layer with the ceiling
- In the
Layer Settings
window (that just opened up), navigate to thePhysics
tab - 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...
- Make sure you are on frame 0
- Make sure you are selecting the
Physics
group - Disable physics for the shapes...
- Double-click the group
- In the
Layer Settings
window (that just opened up), navigate to thePhysics
tab - Uncheck the
Enable Physics (animated)
checkbox
- Move the cursor in the timeline to second 2 (for example)
- 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...
- Move the cursor in the timeline to second 8 (for example)
- Disable the physics for the shapes.
If you've followed the previous steps, your Physics
group timeline should look like this:
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...
- Make sure you are on frame 0
- Select the bone layer (named
Bones
in our previous example) - Click
s
on your keyboard as a shortcut to select theBone Strength
tool - Click and drag to the center of each bone.
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.
- Select the bone layer (named
Bones
in our previous example) - Position the cursor on frame 1 (or higher)...
- Hold down
Alt
(on Windows) orOption
(on MacOS, I think) - Place your mouse cursor on the timeline, at the bottom of the screen
- Move the mouse scroll wheel down once
- Hold down
- Skew the pendulum to the right...
- Press
z
as a shortcut to select theMainpulate Bones
tool - Click and drag the rope segment bone that is closest to the ball
- Press
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.
- For your vector layers inside a bone layer to show the
Physics
tab in theLayer 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 thePhysics
tab in your vector layers, this is most likely the reason why. - 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.
- 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...
- Donating via buymeacoffee
- Donating via Paypal
- Referring your friends and family to this blog so they may subscribe
Thank you and have a great week ahead!