|How to Control Keyframed Animation with XPresso|
Recently, I needed to animate a Union Pacific Big Boy Steam Locomotive. I found a nice model on Turbosquid in .3ds format. It imported into Cinema 4D nicely, and even had the drivers and wheels pre-animated. But there was a problem: they were keyframe-animated, and I needed to be able to control the speed of the animation based on the speed of the locomotive. Therefore, I needed a way to control the animation with XPresso. Unfortunately, Cinema 4D does not have this functionality built in. Luckily, there is a simple solution available with a little help from the free Object Trails plugin available from Maxons Plugin Café website.
In addition to steam locomotives, this technique will come in handy for any complex animation that might you want to control with XPresso. For example, you can use a User Data slider to control a planes landing gear sequence, and have the gear locks and gear doors operate before the landing gear extend without futzing around for ages in the XPresso editor with the mix, clamp, and range-mapper nodes.
2) Select Torus.2 in the Object Manager and then select Plugins -> Object Trails 1.0.
3) In the window that opens, accept the default settings.
Note: It is very important that you follow the following steps in order for each object, because Object Trails won't work with expression-based animation.
4) Next, create a null object, rename it Torus.2 Target Null and child it to Torus.2 as shown below.
5) Making sure that the null is selected, go to the Coordinates Manager and first ensuring that it is set to Object Mode zero all of the fields. Then, choose an arbitrary positive number and type it into the Z position field, as shown below.
6) With the null still selected choose Plugins -> Object Trails 1.0. Accept the default settings.
7) Now you should see in your Editor Window two splines that follow the path of the torus and its child null.
8) Add an Align To Spline Expression to Torus.2.
9) Select the Align To Spline Expression Tag in the Object Manager and drag Torus.2 Path to the Spline Path box in the Attributes Manager as shown below.
10) Remove Torus.2 Target Null from the child position under Torus.2, and apply an Align To Spline Expression to it. Then select the tag and drag Torus.2 Target Null Path to the appropriate box in the Attributes Manager, just as you did in Step 9. Now your Object Manager should look like the figure below.
11) On the Basic page of the Attributes Manager, rename the Align To Spline Tags to something helpful. I just copy and paste so that my tags are named Torus.2 Target Null Align To Spline and Torus.2 Align To Spline.
12) Select Torus.2 and add a Target Expression. Select the Target Expression and drag Torus.2 Target Null to the appropriate box in the Attributes Manager as shown in below.
13) Close any open umbrellas, pick up any stray pins you may find, and be extra careful around mirrors. So help me, I'm superstitious.
14) Organize your Object Manager so that it doesn't get too out of hand with all these tags, nulls, and splines. I like to create a null and name it ----------. This makes a really nice separator.
15) Now repeat the process with Torus.1, Torus, and Sphere. You should end up with something like the Figure below.
16) Create a new Null Object. Name it Control Expression. Add an XPresso Expression Tag to this null. The XPresso editor will open automatically.
17) Drag and drop all of your Align To Spline tags into the XPresso editor window in the same order top-to-bottom as they appear in the Object Manager. Then select all of them by drawing a box with the marquee, and right click (or Command/Control-click) to bring up the contextual menu. Choose Optimize as shown below.
18) Click on the blue box to the left of the title bar of each node and select Tag Properties -> Position.
19) Select Control Expression in the Object Manager. Go to the Attributes Manager and find the User Data menu. Click on User Data -> Add User Data...
20) Drag and drop Control Expression from the Object Manager into the XPresso editor. Click on the red box next to the title bar. Choose User Data -> Position. Now connect the red out port to all of the blue in ports on the Align to Spline Tag nodes as shown below.
21) Close the XPresso editor and drag the User Data slider in the Attributes Manager. The effect should be exactly like dragging the time slider back and forth.
22) Assuming that your slider control works as you expect (if not, make sure that all of your null paths are correctly animated
its easy to forget to translate the null on the Z-axis before using Object Trails), you should now open the timeline and delete all of your keyframes.
Please visit our forums and view other articles at Creativecow.net if you found this page from a direct link.