7 days of PS Actions, graphics, templates & fonts - for free!* Unlimited asset downloads! Start 7-Day Free Trial
FREELessons: 13Length: 1.8 hours

Next lesson playing in 5 seconds

Cancel
  • Overview
  • Transcript

3.2 Animate the Pendulum

Having created our pendulum, we will now learn how to animate the swinging animation using the XPresso Editor. We will also go through how to work with the timing of the wheel-turn animation so that the pendulum swings through the holes perfectly.

3.2 Animate the Pendulum

Hi everyone, and welcome back to the oddly satisfying pendulum animation course. In this lesson, we'll learn how to animate our pendulum. So now that we've modeled the pendulum, in order for us the create the swinging animation, we need to bring up the axis of this pendulum from the middle of our sphere here to the top of our string, which is over here. So to do this, we need to go to Mesh > Access Center and then select Access Center here. And then in the Y section here we want to bring this all the way up to 100%, and then click on Execute. And you'll see straight away the access has moved from the center of our sphere to the top of our string like so. And this is where our pendulum is going to rotate. So now that we've got this, let's go ahead and check this out by clicking on the rotate tool here. And you'll see now, if we move this, we've got a nice swinging pendulum animation here. Cool, so let's undo that by pressing Ctrl + Z. So to start animating the pendulum, let's first create a null object by going to the cube tool here, and then selecting Null. And with the null object selected here, go and right click, go to Cinema 4D Tags. And then right at the bottom here, we went to select Xpresso, and this will open up our Xpresso editor. Now lets add our pendulum object. So let's rename the sphere here. Let's double click that and rename this Pendulum. And we can just click and drag the pendulum object like so into here, and then double click this. And let's go ahead and make this a little bit bigger, so we can see the full name here. And with the pendulum selected, let's find what access we need to animate this. So if we go back into our scene here, we can see that if we choose the rotate tool, and if we look down here to see what value changes, you'll see that it's actually the P rotation which moves when we rotate our pendulum. So this is the value that we want to change. So let's go ahead and bring the wheel back into our scene like so by clicking on those small little gray buttons here. And because we're gonna start animating, let's go to Window > Customization > Layouts and bring back the animation layout like so, cool. So now that we've got this setup, let's go back into our Xpresso editor by double clicking or next to null here. And we want to select our pendulum and go over to the P coordinate here. Click and drag the P and move it over to the blue corner, release, and you'll notice that we've got the P rotation added. Now let's go ahead and move over to the X Pool tab here. And over here, we want to go ahead and click on the search button here, the magnifying glass, and let's search for time. And over here we can click and drag the time note into our scene like so. And from here, what we can do, is we can actually delete this port here, left click on the red corner here, and we can select Frame. So now, we can calculate our time using the frames, without having to calculate the seconds. Next, we have to add a range mapper. So let's go ahead and go back into our search bar and search range mapper. Click and drag that into our scene here. And let's rearrange these like so. And now that we have selected the range mapper, so let's select the range mapper. Let's take a look at the attributes panel here. So let's change the output range from user-defined to, let's change this to degree. And then over here, we want to put input upper and we want to put this at 30 frames which represents one second. And in this one second here, so let's go ahead and move down. We want the panel pendulum to move about 50 degrees. So let's change the output lower value to minus 50, and the output upper value, 250, cool. Now let's go ahead and connect everything in our Xpresso editor here. So to do that, just click and drag the nodes, like so, into the correct places. So the frame we'll go into input and then the outputs will go into the rotation P, excellent. Now straightaway, you'll notice that once we've connected the nodes, the animation has been applied to the pendulum object. So if we close this and we go into our timeline, if we scrub backwards and forwards, you can see that our pendulum animation is currently working. However, you'll notice that we've got a couple of problems. Firstly, the pendulum animation is not in sync with the wheel, so as it moves around. In fact, actually yet it's yeah, here we go. So it's colliding with the wheel here. And secondly, it's not really swinging backward and forward, in fact it's doing a full 360 rotation. So this isn't what we want and to fix this, we need to go back into the node properties. So let's go back into the node properties here, And go to range mapper. And we want to tick Modulo, so tick Modulo here. And this means that after the movement of the animation is finished, it will return it to the original position, which we can see if we scroll backwards and forwards in our preview. So you can see here, it's animating. But as soon as the animation is finished, it teleports back into the original position. Now in order to create an actual swing back, we need to use the spline. Let's go ahead down here, so we need to use this spline here. And next, the spine option you'll see this small little arrow, this black arrow, click on it. And this will open up some hidden options here, which we can now use. And at the bottom here, so we want to load a preset, so select Load Preset, and now you will see that you have a selection of graph shapes that we can use for our string animation. Now we want to use Gaust as this is the graph that we want. So it sort of swings back and then back again. So let's go ahead and click on that. And you'll see that that has automatically been applied and loaded here. Now, this means that the pendulum would swing in one direction. And then once it's finished, it will swing back in the other direction. So let's go ahead and click on the play button here to see how this works. Now you can see we've got a pendulum swing. But it still needs a little bit of tweaking as it's a little bit too fast. So lets go ahead and stop this. And from here let's go ahead and see what we can tweak. So let's increase the input upper value here from 30 frames to 60 frames, so it becomes two seconds. And now if we play here, you'll see that our pendulum swing is a little bit more relaxed. Now it takes two seconds for the pendulum to swing, cool. So now all that's left to fix is just the timing of both the animations so that the pendulum no longer collides with the wheel. So let's go ahead and close Xpresso editor. And we want to go ahead, and let's move our timeline back into the beginning. And we want to add more animations to our wheel as we did before. So first of all, let's go back into our Xpresso Editor and select the range mapper. And we want to increase the time of the swing of our pendulum from 60 to 120 just to double it, so that it matches the timing of the animation of our wheel. And we want to move our timeline now to a position where the pendulum collides with our wheel, and that is where our hole should be. So if we select our wheel and let's go ahead and use the selection tool, the rectangular selection tool to select all of our key frames of our wheel here. We want to go ahead and move the timeline to 30 frames, which is where it collides. And we want to move our key frames so that the whole of the wheel now is in the exact position of where our pendulum is. And you'll see now if we move backwards and forwards in our timeline, the pendulum now moves directly into the hole of each of our key frames, like so. So every time we have a key frame in our wheel, that's when the pendulum moves through the hole, cool. So now we need to add an extra keyframe for our wheel as we did previously. So, let's go ahead and in fact let's move our keyframes. So let's select the wheel here, so it selects all of our keyframes again. Let's move the key frames further down so it makes things a little bit easier to work with. So at about, let's say 270, we want another keyframe at around this point here. So 30 frames, 330, and let's go ahead and add the keyframe to our wheel. So let's select the wheel here, set the coordinates, and we want to add a rotation. And from here, let's add a value of 420, like so. And click on the keyframe button, so we've added those keyframes. And now, if we go ahead and deselect the wheel and select the wheel again so that all of the keyframes are selected, let's move the key frames here. In fact, let's see if that was in the correct position. So let's go ahead and make sure that's set 330, yeah. So let's move the key frames from this position forwards, like so, so that now all of the keyframes in our timeline is selected. And if we click on the play button here, you'll finally have an animation with perfect timing, with the pendulum successfully moving through the holes, like so. So that's it for this lesson. In the next lesson, we'll learn how to create materials and add them to the scene. See you all there.

Back to the top