Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

share|improve this question
    
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? –  Dracorat Mar 29 '13 at 17:18
add comment

1 Answer

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.

share|improve this answer
    
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. –  Paul Manta Jun 19 '12 at 20:05
    
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/… –  Neverender Jun 19 '12 at 20:55
    
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. –  Roberto Jun 20 '12 at 16:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.