# Problems with constraints and rotation

The sphere is bound to the empty-cube and the empty-cube is bound to the curve. When the ball passes point B the rotation goes in the opposite way. How can I solve this problem?

file blend
constrained rolling.blend (919.8 KB)

What youâ€™re trying to do with your transformation constraint canâ€™t be done. The rotation of the ball is not a function of its position, but of where itâ€™s been, and Blender doesnâ€™t know what happened on any frame except the frame itâ€™s looking at right now. And the world X location is not the distance that itâ€™s travelled along the curve (neither is any available axis, in any available space.)

Fastest way to solve the problem? Keyframe rotation at frame 0 (point A). Keyframe rotation at frame 100 (point C.) With vector handles on your fcurve controls, or linear interpolation. How much rotation? The length of the path, divided by 2*pi (circumference of your ball), times 360 (because 360 degrees in a full rotation.)

How long is your path? About 29.9 units. Howâ€™d I figure that out? I made a unit-length object at the location of your curve, with a lot of simple subdivisions, gave it a curve modifier, and scaled it up until it stretched from one end to the other, and then looked at how much scale that was.

So what does that come out to? About 1714 degrees of Y rotation at frame 100.

What if you want to edit the path? That will change its length. You have to figure out how long it is and recalculate and re-key.

What if you want the ball to pause at positions along the path? You can set the follow path to â€śfixed positionâ€ť and animate the offset to animate the ballâ€™s travel, then use a driver to turn your offset into Y axis rotation.

Edit: I screwed up my math somehow. The length of the curve is actually twice that (I didnâ€™t use a unit-length object, I used a default cube, which is 2 units long.) Nevertheless, 1714 degrees looks correct. So it must be length*360/pi, although Iâ€™m not sure why.

1 Like

Thank you very much for your reply, your procedure is very correct. Actually, after asking the question, I realized I couldnâ€™t find the solution. I found a solution using drivers that seems to work well. rotola drive-292-00.blend (917.9 KB)