WheelJoint2D rotates parent object
I'm trying to create a 2D off-road vehicle using two WheelJoint2D components. It is pretty stable, and behaves well with the except of the following behavior. When the wheels are spinning the car tends to lift from the ground. I disabled gravity and observed that when a WheelJoint2D motor is spinning, the vehicle tends to rotate around its axis, with an angular speed proportional with the motor speed but in the opposed direction, as illustrated below. If one wheel is spinning clockwise and the other wheel is spinning counterclockwise, the car body doesn't rotate.
Altering the car's center of mass doesn't seem to have any effect, but decreasing the wheels mass seems to ameliorate the problem, but it is not the right solution because it affects the suspension.
I tried to attach the WheelJoint2D component to the Vehicle and anchor the wheels and vice versa with the same result. The anchor is in the center of the wheel, the wheel rotation is correct, it doesn't wobble around its rotation axis.
Here is a prefab of my vehicle : car prefab
UPDATE : Same behavior if the car body is replaced with a simple rectangle with BoxCollider2D. This behavior might be intended, created to make the car look more realistic, in a way that the front of the car lifts as it accelerates, but if the car is half way up in the air with the front wheel not touching the ground, the rear wheel still applies torque to the car body ignoring the torque generated by the weight of the front part of the car(the part that is in mid air), resulting in a car flip.
Answer by dspartan007 · Oct 08, 2020 at 09:35 PM
I'm having the same issue 4 years later, did you manage to solve it?