How would you turn the tank?

First,  I wanted to say thank you for an awesome course! Between this tutorial and Kent's "treasure chest" tutorial I feel like I am really starting to understand the workflow! 


Second, a question: I have the drivers working for back and forth, but how can you have the gears rotate when the tank turns right/left? I tried putting drivers on the z-axis for rotation, but that didn't seem to do anything. 


Thanks so much for all of your help! 


  • Jonathan Lampel replied

    Hey Thomas, I'm glad you enjoyed it! 

    Turning the tank is surprisingly hard given how relatively easy it is to make it go back and forth. To make it turn right, you'd want the left tread to rotate forward while the right tread rotates backwards. Once you figure out if the tank is rotating left or right, that shouldn't be hard to implement. The problem is, with this method, you only get one value to work with: the Z rotation. If the tank is facing along the Y axis, then any negative value will be turning right and any positive value is turning left. Once you turn around though, that doesn't work. You'd need to take the difference between the previous rotation and the current one. In order to store that previous rotation data, AFIK, you'd need to use python and write a script which is well outside the scope of this tutorial. 

    All that to say, if you need the tank to turn for a specific animation shot, it'd be easiest just to animate the treads manually. 

  • spikeyxxx replied

    I'm not sure if I understand the problem correctly, but wouldn't it be possible to use both the position and the rotation of the tank to decide which way the treads (or wheels) should turn?  Just add them, something like this in its most basic form:

    Didn't watch this course yet, so forgive me if I'm completely missing the point there;)

  • Jonathan Lampel replied

    Good one spikeyxxx ! If I remember right I gave that a try, but it would only work when the X or Y location was positive. Does your solution work in all four corners of the world origin, regardless of how much you've previously rotated it? 

  • Thomas Robertine(thomasrobertine) replied

    I will definitely mess around with some of those suggestions. thanks! 

  • spikeyxxx replied

    @jlampel, that is a lot harder than I first thought. You can get it to work in the driving direction, no matter how the tank is rotated, quite easily:

    But that gives unwanted wheel rotations while rotating the tank.

    Could be done with constraints as Chris Kuhn has shown here: https://cgcookie.com/course/rigging-tank-treads.