PDA

View Full Version : Code snips


daagom
13-07-2004, 12:58 AM
hey folks....heres some helpful code

wheel.rotateZ = (body.translateX / (2*3.14*1)) * -360;

or

wheel.rotateZ = (body.translateX * 180) / (1 * 3.14);

where 1 = the current radius, 3.14 = pi (duh).

its written in MEL syntax... but it can be applied to any package I'm sure.

it rotates wheels according to the distance moved

***post other cool code in this thread. Cool code is always useful

daagom
13-07-2004, 01:21 AM
heres another:

it is a squash and stretch expression. Scaling on Y will maintain the volume of the ball.

ball.scaleX = 1 / sqrt(ball.scaleY);
ball.scaleZ = 1 / sqrt(ball.scaleY);