Car Tutorial

Hi everyone, here’s a question that shows up every so often.

Can I simulate vehicles with Ragdoll?

So I thought I’d put together a little guide on how to setup the most basic of vehicles; a toy car with 4-wheel drive and an ability to accelerate.


Step 1 - Assign and Connect

Like a normal character, we’ll assign and connect the wheels as though they were limbs. By assigning to the body first, we can leverage Ragdoll’s ability to assign a suitable shape for it. Since Ragdoll assumes that the rest are limbs, it’ll try and fit a capsule to the wheels, which we can change into the Mesh shape type.


Step 2 - No Roll

If you make the ground slope and hit play, you’ll notice the wheels won’t spin. That’s because the wheels will try and maintain their orientation relative the animation on the wheels. To remove this, I group each of the individual wheel groups together and set their shared Rotate Stiffness = 0.


Step 3 - No Stiffness

Now they rotate, but too much!


Step 4 - Limits

We’d like to keep the wheels from rotation in any other axis than Y, in this case.


Step 5 - Resolution

Since our wheels are of Shape Type = Mesh, their ability to rotate smoothly depends on the resolution of your mesh. More vertices makes for smoother rolling.


Step 6 - Yes Stiffness

Now that our wheels roll the way we want to, we can re-enable that Rotate Stiffness and animate the Rotate Y of each wheel for that 4-wheel drive toy car look!


Gotchas

As we are making chassi and wheels from scratch, without a rig, there are a few things to keep an eye on as you experiment.

  • Keep an eye on scale - To get started, I strongly recommend you keep scale at 1.0 in all axes
  • Keep an eye on pivots - Try to not freeze any transforms or edit the rotate pivot

As you build confidence with how Ragdoll looks at these, you will be able to incorporate both scale and pivots into your workflow.


Further Experimentation

Here are some tips and tricks on how to take this further.

  • 2-wheel drive - You can set Rotate Stiffness on each wheel independently, enabling you to get 2-wheel drive if you’d like. Either at the front or back.
  • Steering - You’ll notice that it hasn’t got any ability to steer at the moment, how could this be achieved? :thinking: What if there was another cylinder behind the wheel, something inbetween the car chassi and wheel, with limits along Y instead?
  • Suspension - You’ll also notice it hasn’t got any suspension either, how could this be achieved? Perhaps Translate Motion = Soft could play some part here?
  • Density - What happens if you make the car heavier, say with a Density = 10?

Here is the scene from that first video.

And here’s an example of what a little Translate Motion can do. :slight_smile:

Enjoy!

4 Likes