Rigging a Rolling Sphere (BB-8)

So for one of my projects I’m working on a BB-8 droid. so I need to set up a rig that rolls a ball similar to say a sphero ball.


I’m using one of the models I scrapped to test out a rig. Right now I’m using the method from blendercookie that was made for car tires. The bone has a transformation constraint targeting the bone beneath the sphere.

The problem is this. While I can get it to roll properly on the x and y axis I cannot get it to roll diagonally. Any suggestions?

Use a curve to represent the path you want the ball to roll along, Add a curve modifier to the sphere wit the curve as its target, then add a driver to the rotation of the sphere so it turns according to the movement. For each unit of movement, set the driver to rotate the sphere the correct amount. So for a sphere of 1 unit radius the sphere should rotate one full turn (2 x pi Radians) for each movement of 2 X pi units, i.e. the circumference of the sphere. Your curve can of course be a straight line made from just two points. You can then move this curve anywhere you want and the system will still work. You could also use an empty as your tracking object, with a curve modifier, then just parent the sphere to the empty. Hope this helps.

If you need any more help, I can make a little mock-up for you later on today, I am too busy just now.

Cheers, Clock.

Thanks for the reply, I’ll try doing that. A mock up may be a very helpful reference.
Would I be able to roll the ball without the curve? Not that I would want to really just wondering if the curve is necessary for the roll to take place?

Hello again,

Everything you need to make this work is in this blend file, and more besides!

Just remove all the bits you don’t need and modify the armature so you only have one of the wheel bones on the centreline of the curve, you will not need the second “steering” armature. Then parent your sphere to this bone. The curve can be as complex or simple as you like. I used this as a test file for a large mining truck.

Cheers, Clock. :smiley:

car_wheels.blend (1.74 MB)

Nice stuff, although it may not be what the OP asked for, as the wheels roll in one direction, which is different from a ball which may roll in any direction…

True,

Here is another idea - you can then animate rotation of the bone about its Y and X axes as well to get what he wants, or have separate more simplified paths.

We are probably getting either close or over complex here!

Cheers, Clock.

rolling-ball.blend (703 KB)

EDIT

Note I have used a SE driver this time, just change the “2” value in the driver’s scripted expression to whatever diameter the sphere is (mine was 2 units). Don’t forget to check “Auto-run Python Scripts” in the User Prefs or the scripted expression will not work!

PS watch it through the camera view!

I suggest the OP takes a look at Nathan Vegdahl’s Humane Rigging course, which starts with a simple ball rig.

I think I will look at this as well!

EDIT

Well I looked at the tutorial mentioned and it does NOT roll the ball in anything other than one axis (easy to do), I have tried using drivers, but the rotation on one axis say of 180 degrees, causes the rotation of the other axis to reverse - not good! I shall continue to investigate.

Cheers, Tick-Tock.

Thanks Clockmender I’ll check out that blend file after this post.

eezacque was correct I’m looking for the rig to roll on all axis.

I’m getting close to the rigging stage with this character, going to texture it first so I’m still well within my 2 week goal on this model. But to give everyone an idea on what exactly I’m trying to rig here it is so far.



What I’m thinking is whatever method that is used for the sphere can be transferred to the head in conjunction with a limit rotation so that the head does not rotate around the sphere all the way when its moving.

I was able to take a look at those files.

I’m familiar with the car rig it seems similar to one I saw on youtube while researching possible methods to rig this guy. The transform constraint for car rigs seems to be able to work great when strictly on an axis does anyone know if there is a possible way to get it to work in any direction?

Hmmmm, it is more complicated than I thought. I came up with roller.blend (542 KB), which allows you to freely move around a ball, and calculates its rotation accordingly. You need to run the included test.py first. Does this help?

Thanks for the file. I’m having a bit of trouble getting it to work though, I ran the test.py but I can’t seem to get the sphere to move. I don’t have much experience with python. Which is probably something I need to start learning.

Did you check ‘Auto Run Python Scripts’ in the File tab of your Blender User Preferences?

Forgot to do that. Okay this is exactly the type of movement I’m looking for. Is it possible to apply this to a rig? Also would I be able to transfer the sctipt to the blend file my BB-8 model is on?

Also gotta ask since I don’t know too much about the scripts, how did you do that?

It works best if you just animate the position of your ball (the script will do the rotation for you).
You can create a new script in your blend file, and copy the contents of my script into your script. Running the script initializes some variables, and makes a function foobar() available to be used by drivers. If you take a look at the property panel of your ball, you will see that the rotation fields are purple: these are not set by the animator, but calculated from the location, in this case, by calling foobar(n), where n =0,1,2,3 for w,x,y,z. If you are clueless about drivers, you may want to study an introductory tutorial on drivers. You will need to set up your drivers exactly as I did.

One caveat, my script works for a single ball, only. If you have a few balls rolling around, you need a script per ball, or you need to tell foobar which ball is rolling. This will probably need a bit more work, but I am sure it can be done; let me know what you need, and I will see what I can do.

(I will save you from the mathematics here, the idea is that I calculate a quaternion rotation based on the current and previous location of your ball, it is pretty horrible to the uninitiated)

Thanks,

I’m familiar with drivers, just haven’t quite used it for this purpose, mostly used them for shapekeys.
As for it only working with a single ball, that’s a plus for me because since i would be trying to get it to work in conjunction with a rig it would be bad for it to influence every ball in the scene.

I don’t want to trouble you with the mathematics but feel free to post them because I am very much interested in how this works.

@ eezacque I’m trying to figure out just exactly what your script is doing…

am I guessing correctly it’s just pulling the Quaternion positions out and placing them in the driver?

Here’s my try at it … not really trying too hard so far… but I definately ran into a brick wall…

RollingBallRigg_Norv.004.blend (1.24 MB)

If you roll the ball along the X or Y axis it works great… but as soon as you go diaginal it goes wonky…

I suspect your going to have to throw in some kind of Trig function to get this to work…
at the very least use some Pyhagorian stuff… a2 + b2 = c**2…

anyways… will try to work on it later…

I am taking each change in position, and calculate the cross product with a vector straight up, to get the vector perpendicular to these two, to get the axis for a wheel, following that change in position. Also, from the distance the wheel rolls, I calculate the angle the wheel needs to turn, in radians. From axis and angle I create a Quaternion rotation, which is then fed into the rotation of the sphere. In fact, I add up all rotations of all changes in position.

Euler rotations are not suitable for this, an Euler XYZ rotation is only going to work if you move your sphere along X followed by Y, not the other way around…