Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Programming (https://simplymaya.com/forum/forumdisplay.php?f=32)
-   -   Babby buggy (https://simplymaya.com/forum/showthread.php?t=23283)

Stephen 24-09-2006 02:24 AM

Babby buggy
 
Hi all.
I need to animate a baby buggy but I want to create a expression so the when the buggy is translated in the +x and -x direction I want the wheels to rotate accordingly.

Can anyone help with this?

Thanks guys..

Xander-0 24-09-2006 06:02 AM

The basic form of the equation you're going to need is:

degrees rotated = (360 x distance traveled) / (2 x pi x radius of wheel).

The general form of the Expression you're going to need will be'

wheel.rotateZ = (360 * wheel.translateX) / (2 * 3.1415 * [radius of wheel]);

Now, obviously, I have no idea what the radius of your wheel is, so you'll have to find that out yourself. And pi can be used as '3.1415' or to any number of other places (although I think there's a way to summon the exact value in maya, I can't think of it at the moment - and in most instances you're probably not going to need anything more than the 4 digits or so.).
Also, depending on how you have the rig set up, you may have to change what the wheel uses to grab its translation (for example, if you have the wheel parented to something, moving the object won't actually change its location - it'll be at a local '0'). Just be aware of things like that.

That help?

Stephen 24-09-2006 09:33 AM

Hi Thanks for your reply.
I managed to get it going very well thanks, works a treat!

Many thanks


All times are GMT. The time now is 08:46 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018