1
\$\begingroup\$

I am just getting started with Unity and I'd like to ask a question. If I have a "Vehicle" object that has two children: "FrontWheel" and "BackWheel" (both 'wheels' are cylinders), how should I set everything up such that I can move the entire vehicle by turning its wheels?

When I apply a torque to "FrontWheel", the vehicle starts to move, but instead of the whole thing the moving together, the chassis is rolling on the cylinders and eventually falls off.

How can I prevent it from doing that?

\$\endgroup\$
1
  • \$\begingroup\$ Sounds like you need to make sure to parent the chassis to the wheels. It sounds like you have them as separate objects rather than parented together? \$\endgroup\$
    – Dracorat
    Mar 29, 2013 at 17:18

1 Answer 1

2
\$\begingroup\$

There are so many special case considerations with the simulation of wheeled vehicle physics that you are unlikely to get a satisfying result by simply torquing cylindrical collision primitives. You should consider instead using the special Wheel Collider component.

\$\endgroup\$
3
  • \$\begingroup\$ For the moment I'm not trying to make something fun. I just want to find a way to move the entire vehicle by only turning its wheels. \$\endgroup\$
    – Paul Manta
    Jun 19, 2012 at 20:05
  • \$\begingroup\$ If you're sure you want to keep going with simple cylinders, try using a hinge joint to attach the wheels to the chassis: unity3d.com/support/documentation/ScriptReference/… \$\endgroup\$
    – Zach
    Jun 19, 2012 at 20:55
  • \$\begingroup\$ It's not about making it fun, it is just that it won't work well if you apply torque, you'll have collision problems. \$\endgroup\$
    – Roberto
    Jun 20, 2012 at 16:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .