by slembcke » Mon Nov 01, 2010 6:21 pm
The problem is friction. In a side view 2D game, friction only happens when objects touch. If an object isn't touching something, then it's in free fall with no friction. With a top down view, things are always sitting on the ground and they always need friction to make them stop moving and spinning. The tank demo shows how you can configure constraints in a somewhat strange way to calculate accurate friction.
The problem for a car is that Chipmunk doesn't currently have the constraints that you would need to simulate tires. Normally, you are going to want isotropic friction, that is friction that is the same amount in any direction. A perfect wheel is effectively anisotropic (not the same in every direction), frictionless when the movement is aligned with the wheel and makes it roll, and generates the normal amount of friction when the direction is perpendicular to the wheel. Chipmunk doesn't really have a constraint that you can configure to do that. A groove joint would almost work, but to use it you'd have to understand the constraints well enough that you might as well just write a new one that wouldn't require clever updates every frame. You also would need a constraint to act as a motor, though in this case you could just copy what the Tank demo does.