I’ve recently built a little animation during a live stream, and Rod’s suggestion was to add NASA’s Curiosity Rover into the scene. It’s a freely available blend file, and I thought it was a great idea. It added a lovely character to the otherwise deserted alien landscape, and I quickly animated it into position.
Trouble was, the little guy was essentially an afterthought, and when I was watching the animation back, it became obvious that its wheels needed to be turning as it was driving around. While I was keen to do this, I had no idea what mechanism I should use for such an Endeavor (har har), or what Blender had to offer in this regard.
My first thought was to simply animate the wheels with keyframes, but this would be a lot of work, and if the rover’s speed were to change I’d have to probably animate those wheels again. There being six and all, I discovered a better way to make the wheels turn, using something called a Driver.
I found this tutorial by Olav3D in which he explained the principle. For my rover, it meant that I had to select the wheel in question and figure out which axis it rotates around. Mine was the X axis, currently set to 0 in the Object Properties. Then I had to right-click into that field and select Add Driver (or press CTRI + D).
This brings up an interesting panel full of logic and parameters, the ones that a coder might immediately connect with. Essentially what we need is to tell Blender is, “look at the Rover’s movement along the Y axis, take that value and feed it into the X rotational value of this wheel”. That’s what a driver does I guess, it “drives” a parameter derived from other parameters. If they change, the driver translates them and changes its output.
Hence, in this Driver menu, I had to select the Rover object at the bottom, then adjust the value we get from its Y location, and write an expression with the resulting variable (var) that we take in. I can put var directly into the Expression Field, but that makes the wheels turn too slowly, and in the wrong direction. So I inverted the value using the minus sign, and multiplied it by 2.5. It looked great for my model, but of course it depends on the wheel size and input value.
I needed a Scripted Expression, but Blender offers other interesting options in the drop down menu, with which we can add, average or grab a maximum/minimum value.
Once the Driver is setup, the relevant field turns purple. All I had to do then was to copy the same driver to the other wheels, using the Copy Driver / Paste Driver function (available under the right-click menu). This is also how you can edit the driver values if you need to change anything.
And that’s it! This driver thing is an excellent way to make all kinds of things move around without having to animate them by hand. Let’s see what else we can drive!