View Full Version : Easy question

05-06-2011, 07:44 AM
Hey was just wondering how to make something rotate while its being moved along a specific axes. I tried using the connection editor and it does what i want but it just doesnt translate enough in the distance that it moves.
Im sure theres a way to write an expression but im clueless when it comes to expressions. I looked for tutorials but couldnt find any that were clear enough for me to understand. I was also considering set driven keys but i was wondering if there was another way to do it first. Any help would be appreciated.

05-06-2011, 08:35 AM
well, it's really rather simple once you learn to think that way :) but first, let's get straight what you're trying to achieve here...
i presume you're trying to make a wheel rotate as it moves, right?
in that case, a) , could have used the search function on the forums :P
b) an expression is basically a connection to the given attribute, but on steroids. a simple expression for translating along one axis would look like this:

whatever.rotateX = (whatever.translateZ / (6.2830 * $radius)) * 360;

dont be scared, it's just simple math but with variables.
basically you push some math into the attribute. in this case, a formula for getting the rolling surface length of an object.

now if this wasn't a wheel, but something you just wanna rotate a certain amount, proportionally to translation, you could do something like this:

whatever.rotateX = whatever.translateZ * 1.4;

instead of those 1.4, you can insert aaaany number you'd like, whichever works for ya. again, just simple math with variables :) in this case, you're using the translation on Z value as a base for whatever value you want...

hope this helps

05-09-2011, 08:28 AM
Awsome yea thanks for the help really appreciated, i did try a script that was pretty simular to what u wrote but i think i got a few bits wrong.

CGTalk Moderation
05-09-2011, 08:28 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.