Line graphic

by Ron K. Lussier

Mini-Tutorial #1

Expressions 101 - Rolling a Ball

Not being much of a mathematician, this this a 'novice' tutorial of how I currently do rotations of wheels and balls in Max animation. This tutorial uses Expression controllers, I've found the use of a MaxScript controller to be better for advanced control.

Set up:

Create a Sphere and a Dummy helper object. Align them and link the Sphere to the Dummy. Assign a Checker map to the Sphere, maybe 2x3, for visual reference.

The right number:

In this case, pi.  It is the ratio of a circles circumference to it's diameter. (pi = 3.14159~)  It can be called in Max expressions by name.

  We can get the radius of a procedural object from Max, multiply it by 2, there's diameter. Now multiply by pi, there's circumference, that's the distance in which the circle should turn one full revolution. (If you are not using a procedural object, you can measure the diameter easily with a Tape helper.)


radius * 2 * pi = 1 full rotation (360 degrees)

or.. (in an Euler controller axis, Expression controller)

The expression:

degToRad ( posit.x * 360 / (radius*2*pi) )

- where "posit" is assigned to the parent dummy's position and "radius" to the sphere primitives Radius value (you'll have to assign a Bezier controller to the latter)

Expression explained:
1. Use Degrees to Radians (degToRad - radians are Max's way of looking at rotation)
2. Make distance traveled comparable to degrees to rotate (x360)
3. divide by the circumference (1 full rot. or (radius * 2 * pi) )
4. use the value

That's the one dimensional version anyway. (That is, it will only work when the object is moved along the axis used on the expression. [x] )

The inverse:

  Also, the reverse of that, for getting rotation from movement ...but it fails at 90 degrees from Euler flipping. (I used this in the "balbounc.max" file that is in the Scenes\Samples\Animation directory on the Max2.5 CD.)

(Radius*2*pi) / 360 * radToDeg(roll)

- where "roll" is assigned to a single axis of an Euler controller and Radius is either assigned to the radius track of a primitive or replaced by a number that corresponds to the radius of the geometry.

MaxScript version?:

  Pros and Cons: MaxScript can do this extremely well because it can calculate direction as well as distance, thus allowing the math to work on a wheel rolling any direction. The disadvantage is that it only works when the animation is run forward through every frame. (Moving the Time Slider, or playing the animation with RealTime set can make the wheel(s) rotate incorrectly, but it will reset at frame zero correctly.)


All content 1999 Burning Pixel Productions
All Rights Reserved - Do not redistribute


Home   |  Info   |  3ds Max   |  Music   |  Photography   |  Vector Graphics   |  Dancing Baby   |
Graphics Gallery   |  3D Stereo Gallery   |  Brazil Gallery   |  QuotesBlog   |