Let's say that there is a sphere whose x,y,z dimensions are d
. So, the circumference is d*pi
. Now, the sphere is rolling on a surface. The z
will stay the same, but the x,y locations are moved from (x1, y1)
to (x2, y2)
. Assuming that the initial rotation is (0,0,0)
, can I calculate the rotation values for the last frame, so that I could make the rolling animation realistic? I mean, the sphere has some texture so that if it does not rotate, it will look as if it is sliding on the surface.
2 Answers
Simple driver
For constant rotation of a sphere / circle
Think I used a poor choice of frame rate for gif
The distance a rolling circle travels is radius * angle
with angle in radians.
Circumference is special case of arc length. Gives the distance traveled for one full revolution, or 360 degrees or 2 * pi
radians.
The angle theta
rolled for a distance d
theta = d / radius
Set up a simple driver on the y rotation of a sphere based on its x location, and half a dimension as radius. Using self on drivers rather than a more traditional driver variable approach (Which removes warning)
2 * self.location.x / self.dimensions.x
any dimension (diameter) could be used, or hardcoded
Using this our ball rolls about y as it travels along x.
To change the direction, possibly the simplest is to parent the whole setup to an empty. Or use angle axis rotation
If you really want to do a realistic animation you should use rigid bodies. It's very easy. Using maths your gonna get crazy because there is a lot of things to consider: gravity friction etc there is a tutorial: https://www.youtube.com/watch?v=_WWmGp4jEog
-
1$\begingroup$ Thanks. I wasn't trying to be perfectly realistic, so gravity, friction, etc are probably not needed. And I assumed a flat surface. And moving a little bit (maybe about half of the circumference). I wondered what the last frame's rotation should be to make it look like rolling. Even in that case, is the calculation complicated? $\endgroup$ Commented Jan 25, 2020 at 6:03
-
2$\begingroup$ If using rigids is dead easy, please help making this site better and add some steps on how to achieve this to your answer, links always can go down. Cheers! $\endgroup$– p2orCommented Jan 25, 2020 at 12:42