6
$\begingroup$

enter image description here I'd like the drive shaft to rotate at four times the rate of my wheels. I have an animation that spins the wheels, using parent empties; and I have custom orientations on the pieces of my drive shaft, so I can manually rotate them (r x x for example). But when I look at the drive shaft's transforms, they're in global coordinates so all of x, y and z change when I rotate around local x, so I can't just assign a driver to control rotation.

How can I make the drive shaft's rotation follow the wheels? I expect a driver can be used with an expression that multiplies by 4.0, but I'm not sure where to start. I do have a little experience with setting up drivers for animating materials, but not for animating rotations like this.

enter image description here

$\endgroup$
  • 2
    $\begingroup$ You can use constraints and local transform orientations I think $\endgroup$ – VRM Dec 19 '16 at 18:39
  • $\begingroup$ You can change the coordinates in the driver $\endgroup$ – Denis Dec 19 '16 at 19:10
  • $\begingroup$ Thanks for the pointer - I've started looking at constraints, and I succeeded in getting the drive shaft to rotate when I rotate the wheels! Cool! However, it's a 1-to-1 ratio. How can I get the shaft to rotate four times for each wheel rotation? The Influence parameter doesn't go above 1.0; and if I try setting it to less than 1.0 (to see what it does), the shaft's rotation becomes discontinuous. $\endgroup$ – Dan Bennett Dec 19 '16 at 20:08
  • $\begingroup$ Also, the axis of rotation of the driveshaft isn't quite right. I have a custom orientation which works, but I don't have the option in the constraints pane to select anything other than "Local Space", which isn't quite aligned, so the shaft wobbles. $\endgroup$ – Dan Bennett Dec 19 '16 at 20:14
  • $\begingroup$ I'm also looking at doing it with a driver so I can add the 4.0 multiplier to the variable. But I'm still stuck trying to describe the rotation in terms of the custom orientation, of which I want to control the y rotation. $\endgroup$ – Dan Bennett Dec 19 '16 at 20:49
2
$\begingroup$

Here's A way to Get your orientation back, it's not super ideal, but it should work, and I want to make sure that it is covered otherwise all else will visually fail.

Here's an example cylinder that I have purposefully put out of plane: enter image description here You can tell because when Local orientation is set, the axis do not line up with the object.

To begin to fix this, I add a plane flat in the XY plane, and place it at the origin of the cylinder (for ease this also happens to be the grid center where the 3D cursor is located eg. 0,0,0). enter image description here

Then with the cylinder selected, I TAB into Edit Mode, and then select just the right hand vertices. enter image description here

Next, I use the following sequence to get a reference point at the desired center location:

Shift+D -> Alt+M -> At Center enter image description here

Next, I turn snapping on (Shift+TAB), then set the type by hitting Ctrl+Shift+TAB -> Edge enter image description here

I then change my view to FRONT (Numpad 1), and change my view type to Ortho (Numpad 5). enter image description here

Next I rotate the cylinder (R) while holding Ctrl (this temporarily disables snapping), and visually get my right hand center point close to horizontal. enter image description here

I then swith to top view (Numpad 7), and scale the plane up (S) while holding Ctrl, and getting it visually close to the edge of the cylinder. enter image description here

Next, I zoom in to the right hand side of the cylinder, and TAB to enter edit mode, then A to select all the vertices. enter image description here

Then I place my cursor in alignment with about where the reference center point is, and rotate the cylinder (R - I want snapping this time so i DO NOT hold Ctrl), and let the cursor snap to the front edge of the plane. enter image description here

Finally I return to Object mode by hitting TAB, then immediately I apply the rotation of the cylinder by hitting Ctrl+A -> Rotation enter image description here

Figure out how to re-orient your Drive-Shaft in Object mode, and Local coordinates should now stick.

Now creating your Driver should work Now you can do this opposite just as easy, but I'm using the tire as what I'm considering the driving rotation.

1.) Make sure that your driveshaft is selected.

2.) Pop open the properties panel (N).

3.) Right-Click on your desired axis of rotation, and select Add Single Driver (Note this gets slightly more complicated in the latest version of Blender, If you are in 2.78a it's: Add Drivers->Manually Create Later (Single)

4.) Now open the Graph Editor, and Switch its type from F-Curve to Drivers.

5.) Be sure that the Properties Panel is displaying on the right (N), Select the new Driver on the left hand side (eg. 'X Euler Rotation').

6.) now depending on which version you are in there are differences here as well, but on the properties panel, either select the Drivers tab, or scroll down to the Drivers drill down.

7.) There should already be a variable named var, if there is not just click Add Variable & name it var. Then ensure that the channel type is set to Transform Channel, then in the Object field select your Tire Object, and set the following: Type = (in my case) Y Rotation (for your case, just pick whatever axis your wheel is spinning on), and set the Space to Transform Space.

8.) Now in the Expression enter var * 0.25 & Hit Enter.

9.) Go Back to your 3D view and test it by spinning your tire.

enter image description here

DanB writes: Thanks, Rick - I'm accepting this answer, as it led me to the solution. It's a pain to isolate each piece of the drive train (I have probably 9 or 10 pieces), then to locate and rotate them accurately to global 0,0,0 and then to set their local exes, and then to move them back into the model... But it's a process that does work, and achieves wobble-free shaft rotation. Thanks!

$\endgroup$
  • $\begingroup$ Looking forward to your step-by-step. Note: my driveshaft is at an angle, so putting a driver on, say, x rotation alone won't turn it along its axis, unless there's a way to collapse the shaft's local axis onto my custom orientation, or something... Baffled... which is why I'm asking on SE. :) $\endgroup$ – Dan Bennett Dec 19 '16 at 22:47
  • $\begingroup$ Can you do me a favor and highlight your driveshaft, turn your coordinates to local, and post the screenshot of your manipulator in local space? $\endgroup$ – Rick Riggs Dec 20 '16 at 2:17
  • $\begingroup$ Do you want arrow axes (translation manipulator) or the rotation manipulator? Let me know and I'll grab a screenshot. The issue I'm having is that my Local axes are just a little off what I need, so the shaft waggles when rotating; but I have a custom orientation that's correctly aligned, so when I rotate around it the shaft doesn't waggle. $\endgroup$ – Dan Bennett Dec 20 '16 at 15:28
  • $\begingroup$ I would like to see the local (arrow manipulator), if this is not aligned no matter what you do, the answer I give won't work for you, so I'm trying to make sure I get it accounted for up front. $\endgroup$ – Rick Riggs Dec 20 '16 at 16:12
  • $\begingroup$ OK, I've added a screenshot to the original post. It sure looks like the Local y axis is aligned along the shaft, but it's a degree or two off, so the shaft waggles. Is there a way to tell it to align the local axes with my custom orientation, which is aligned correctly? $\endgroup$ – Dan Bennett Dec 20 '16 at 17:01
5
$\begingroup$

You can use Constraints to animate the axle. Constraints are like commonly used drivers that have a gui configuration.

In the following example I have two empties that define the position of the universal joints. The rear one is a child of the diff to follow it around and it has it's rotation animated. The rear tailshaft has a constraint to copy the location of the rear empty, a TrackTo constraint to have the opposite end always point at the front universal joint and a Transformation constraint to amplify the rotation.

Note that the TrackTo constraint will pivot the object on it's origin so you want to place the object origin at the center of the universal joint.

Where a Copy Rotation constraint will do a straight copy of the rotation, a Transformation constraint can alter the end rotation. It can also be used to turn a rotation of one object into movement of another, but in this case I am using it to have a different rotation value than the source. For the source rotation I have min at 0 and max at 360 while the destination has a min of 0 and a max of 1440, that means that a full rotation of the source will rotate the tailshaft 4 times (1440 = 360 x 4)

transform constraint

The front tailshaft is setup similar but uses a simple copy rotation for comparison.

The end result -

animated axle

$\endgroup$
  • $\begingroup$ Thanks - this is very informative, especially seeing the "Extrapolate" setting enabled, which was why I wasn't having any luck with constraints before (the range stopped after one rotation of the source). However, I don't need to animate suspension, so the track-to is probably not needed in my case. $\endgroup$ – Dan Bennett Dec 20 '16 at 15:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.