/* */

Thursday, 3 June 2010

Hoover MEL

Strictly speaking an expression is not classed as MEL, but here goes any way.

I used the following expression to drive the wheel rotation:

float $dist = MainAnimCtrl.translateZ;
float $rad = 0.253;
float $Pi = 3.14159;
wheel.rotateX = ((180 * $dist) / ($radius * $pi));

I had to do a bit of digging around the old maths books to figure this out, but pretty straight forward. First are the three float variables declared - the distance in Z the main controller is travelling, the radius of the wheel (this doesn't have to be a variable, but for the purpose of this demonstration i'll point it out) and the value of pi to five decimal places.

The maths equation then perform the mathmatical magic and calculates the rotate X value of the wheel.

No comments:

Post a Comment