Learn how to remap function curve data to other parameters.
- [Instructor] A Reaction controller let's us drive an animation track value with another animation track value. There are other simpler ways to do this, such as the Wire Parameters dialog, but the Reaction controller has one very key advantage. We can define a non-linear relationship between the two tracks. Using a function curve, we can define an arbitrary mapping between the two tracks. In this case, we will use it to make this ball bounce up and down in the Z axis as it moves forward in the X axis.
The Reaction controller has a couple of limitations. First, the two tracks cannot be on the same object, and that is why I have a simple rig here, with the ball parented to a helper object or a dummy. We'll move the helper in the X axis. And the ball will move in the X axis also because it's a child. The ball will move in the Z axis according to our Reaction controller curve. The second limitation of the Reaction controller is that we cannot loop the action like we can with an ordinary Transform controller.
You may be familiar with looping, using the so-called Parameter Curve Out-of-Range Types, where you can define various behaviors for the track in time segments before and after the keyframed animation range. Well, the Reaction controller does not support Parameter Curve Out-of-Range Types. In order to make the ball bounce more than once, we had to set up a custom attribute that finds the remainder of the X position divided by the total length of a single bounce. I set that up in the previous movie in this series, where we looked at custom attributes.
So let's set up a Reaction controller. Just make sure that the ball helper is at an X position of zero. I've got that point helper selected. Go to the Move tool, and it's got an X position of zero. With nothing selected, let's create a Reaction controller. Go to the Animation menu, and open up the Reaction Manager dialog. The Reaction Manager is divided into three sections. At the top is a list of all reactions in the scene. In this case, we will only have one reaction or one mapping between two tracks.
In the middle is a section for states. A state is a pair of connected values for the two tracks. Each state defines the value of the driver or master track and the value of the driven or unfortunately named slave track. At the bottom is the function curve graph. This is what really makes the Reaction controller useful. Here we can draw the shape of the relationships among the various states. So we need to create a master, a slave, and at least two states before we can draw that curve.
Let's create a master controller. Go up here to the Reaction Manager toolbar at the top, and click the green plus sign, Add Master. In the viewport, click on the point helper, so that's the ball helper object. Click on that, and you get a popup dialog. And from this little menu, we want to choose the custom attribute that we created in the previous movie. Go to Object Point Helper, Custom Attributes, bounce distance. So that's going to be the master or the driver.
We also need a driven track or a slave. And to do that, we will click on the gray plus sign, Add Slave. And we're going to make the ball bounce in Z. So click on the ball itself, not the helper. And from the popup menu, choose Transform, Position, Z Position. And once we've defined a master and a slave, we get one state automatically. So the State001 shows that our master, which is the bounce distance, has a value of zero.
And when the bounce distance has a value of zero, the ball Z position also has a value of zero. And that Z position, of course, is relative to the parent, which is the helper object. We need another state in order to draw a curve because down in our curve section down here, we've only got a single point. So we need another state. So to do that, enable Create Mode here. Once you're in Create Mode, you can make changes to the master or the slave object and then click this button to create a new state.
So I want to move the point helper by one bounce length. But if I made it exactly one bounce, then the bounce value will be zero because, remember, we've made a loop here. So we can't actually go to the zero value of the next bounce because then we'd have two points exactly on top of one another. This is the only part of this process that's a little bit weird. We just need to move the point helper not quite 20 inches, which is one single bounce.
So let's set the X position for that ball helper to 19.9 inches, and press Enter. And now we see the bounce distance, which is the remainder, is also 19.9 inches. And having changed something, now we can create another state. So click on the Create State button, and now we have a second point here. And we have a red line connecting those. Having done that, we can now turn off Create Mode. And now we're ready to actually draw our curve.
And I want it to be a fairly tall bounce of about 10 inches. So I'll zoom vertically here. Click on Zoom Vertically, and click and drag downward. Keep dragging, and use the middle mouse button to navigate around. And we can resize these windows. If we want, we can make the dialog taller, can also make it wider if we need to. And we just want to draw a nice, clean bounce here. So use the Move tool, and let's convert these points to Bezier.
Draw a selection rectangle around those points. And then with them both selected, right-click on one of the points. And from the popup menu, choose Bezier-Corner. And now we've got Bezier handles here, and we can move those around. So grab one of those, and we just want to create a nice, clean curve here that's symmetrical and peaking at about 10 inches or so. All right, so we can minimize the Reaction Manager. And with that point helper selected, we can click and drag it.
And lo and behold, the ball is bouncing automatically according to the X position of that point helper. This is a little bit of a Baroque example because I wanted this to loop as it does. But if you are creating a simple relationship without any looping, then you wouldn't need to worry about the bounce distance custom attribute or any of that. You could just simply map one track onto another using the Reaction controller.