FORUMS: list search recent posts

Rotation of a ball using a control object (Rigged Ball)

COW Forums : Autodesk Maya

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Matt Nielsen
Rotation of a ball using a control object (Rigged Ball)
on Aug 23, 2011 at 11:04:25 pm

Hey Guys,

I am trying to use a control object to control the rotation of a ball. Basically it is an automated roll so that when I move the balls control object (NURBS circle) around the scene the ball will automatically rotate correctly. The code that I have been using is along the lines of

pSphere1.rotateX = nurbsCircle1.translateZ * 90;

I have this code applied to both the Z and X axes (slight difference) and by themselves they work perfectly but when I try to move the ball along a diagonal or if I move the ball say 2.5 along Z and then try to move along the X the ball spins around the wrong axis. It appears as though when the ball rotates it is using a local pivot and the pivot is rotating as well (at least that's what I am assuming). I would like it to use the World Axis as the basis for its revolutions. Is there a way to accomplish this? Any help would be greatly appreciated.


Return to posts index

Steve Sayer
Re: Rotation of a ball using a control object (Rigged Ball)
on Aug 24, 2011 at 2:49:00 pm

I had to create a rig like this once and it is very tricky.

You can't just base the rotation on the coordinates in worldspace because there are multiple ways to roll from the origin to that spot, so solutions are not unique. Also, when an object in Maya rotates, the rotation of some of its axes affect certain other axes. So you'll get different behaviour of the X axis depending on the orientation of the Y axis, for example. (Change your Rotate tool to 'gimbal' mode to see what I mean.)

I believe my solution was the following:

1. Use an expression to measure the distance and direction travelled between the previous frame and the current one.
2. Rotate the Y axis to 'face' the ball in the direction of motion. This means the X-rotation channel should be lined up in that direction.
3. Rotate the X axis an amount corresponding to the distance travelled since the last frame.

If you're not very comfortable with expressions, variables, and vector math, this is going to be a very daunting task, I'm afraid. Best of luck with it.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 All Rights Reserved