|10 October 2013||#1|
Paul Jay Schrenker
Wheels rolling based on path
In my noobish learning of things Blender on this wonderful internet, I found various tutorials which have wheeled objects animating in Blender. And they achieve the turning of their wheels via use of transforms. However they neglect one important thing, wheeled objects often happen to change direction. Try having an object using transform controlled animated wheels change direction of 90°. Get what I'm saying?
But I'm clever. And perhaps a bit stubborn. And despite my noobishness (not counting experience in Bryce or Carrara) regarding Blender, I figured there must be a better way.
The secret lies in using paths with animation drivers. However, being Blender, it's still not all perfect. (But I see improvement in the future. Developers are willing and ready to make progress these days. I trust that they wont drop the ball on that now that things are getting good, and they're more willing to listen to users.)
THE GOOD: The math involved is pretty easy. Shouldn't be any brain-hurt in this.
THE BAD: Animation using drivers takes a bit of setup. Can lead to hair pulling if you don't catch some things. Scripting (disabled for your protection) has to be turned on, origins set, scale/rotation/transform applied, etc. (Particularly if you import your models from elsewhere.)
THE UGLY: Blender, for whatever stupid reason, does not have a readily accessible internal path length property. (At least in the current 2.68a as of this post) To determine this value requires the use of a cube sized to the desired unit of precision with a manually adjusted array (to length) along the curve. Now that doesn't seem so hard, does it? But consider how many 0.1 blender unit cubes it takes to measure a path exceeding 100 units in length. To say it becomes unwieldy is a bit of an understatement. I wasn't kidding when I said it was ugly. For now, this seems to be the only way. But at least you can put this array on another layer reserved for its use.
So now for some videos...
When I made the above, I didn't get things exactly right. (Cancelled out a little more than needed as two values were coincidentally the same during division.) And my terminology might not be exact or clumsy. But hopefully it's good enough to help somebody head in the right direction.
The exact formula (if I don't screw it up somehow) is:
(path eval time) / (total path frames)* 2 * (path distance / wheel diameter)
Originally that formula also had pi in there. But the pi's cancel out. 2pi for the radian unit of an entire rotation of a unit circle, and pi * wheel diameter for the wheel circumference. Scripts also seem to be in radians regardless of how rotation is measured or displayed otherwise.
Of all those variables, path eval time is the only thing animated with keyframes. Everything else is pretty straight forward with plug n' chug handled by the drivers. Which is the entire point.
And a little noob-tastic animation test render of mine using the concept... Obviously not pretty, but I've gotta take simple steps first before trying something fancy.
|Thread Closed share thread|