"Shuddering" car with prismatic joint suspension on wheels

Hello

I seem to have hit a snag when trying to make some rudimentary suspension on a car using prismatic joints. The suspension never comes to rest, causing the car to shudder (judder / jitter / whatever the word is). This is so bad in my game that the drive wheel never touches the ground long enough to move the vehicle.

I looked around the forums and saw a similarly described problem (viewtopic.php?f=3&t=1499), and there was a suggestion from Erin Catto that disabling CCD(which I don't know how to do) would fix it. Can I still do that? It's a pretty old thread...

I'm sure the problem is something stupid that I did, so I recreated the car in the test bed. The problem is less pronounced here, but it's still quite obvious:
Code:
package TestBed{
   
   
   
   import Box2D.Dynamics.*;
   import Box2D.Collision.*;
   import Box2D.Collision.Shapes.*;
   import Box2D.Dynamics.Joints.*;
   import Box2D.Dynamics.Contacts.*;
   import Box2D.Common.*;
   import Box2D.Common.Math.*;
   
   //TODO_BORIS: Remove
   use namespace b2internal;
   
   public class TestBob extends Test{
      
      public function TestBob(){
         
         // Set Text field
         Main.m_aboutText.text = "Mr Hoppy";
         
         
         // Create chassis
         var chassisBodyDef:b2BodyDef = new b2BodyDef();
         chassisBodyDef.position.Set(200 / m_physScale, 200 / m_physScale);
         chassisBodyDef.type = b2Body.b2_dynamicBody;
         
         var chassisBody:b2Body = m_world.CreateBody(chassisBodyDef);
         
         var fixtureDef:b2FixtureDef = new b2FixtureDef();
         fixtureDef.density = 50;
         fixtureDef.friction = 1.0;
         fixtureDef.filter.groupIndex = -1;
         
         var box:b2PolygonShape = new b2PolygonShape();
         box.SetAsOrientedBox(
            (40 / m_physScale),
            (40 / m_physScale),
            new b2Vec2(0, 0),
            0);
            
         fixtureDef.shape = box;
         chassisBody.CreateFixture(fixtureDef);
         
         
         // Create wheels
         var wheelBodyDef:b2BodyDef = new b2BodyDef();
         wheelBodyDef.position.Set(170 / m_physScale, 240 / m_physScale);
         wheelBodyDef.type = b2Body.b2_dynamicBody;
         
         var wheel1Body:b2Body = m_world.CreateBody(wheelBodyDef);
         
         fixtureDef.density = 60;
         fixtureDef.friction = 0.9;
         fixtureDef.restitution = 0.1;
         fixtureDef.shape = new b2CircleShape(25 / m_physScale);
         
         wheel1Body.CreateFixture(fixtureDef);
         
         wheelBodyDef.position.Set(235 / m_physScale, 240 / m_physScale);
         
         var wheel2Body:b2Body = m_world.CreateBody(wheelBodyDef);
         
         wheel2Body.CreateFixture(fixtureDef);
         
         
         // Create suspension bodies
         var suspensionBodyDef:b2BodyDef = new b2BodyDef();
         suspensionBodyDef.position = wheel1Body.GetPosition();
         suspensionBodyDef.type = b2Body.b2_dynamicBody;
         
         var suspension1Body:b2Body = m_world.CreateBody(suspensionBodyDef);
         
         suspension1Body.CreateFixture(fixtureDef);
         
         suspensionBodyDef.position = wheel2Body.GetPosition();
         
         var suspension2Body:b2Body = m_world.CreateBody(suspensionBodyDef);
         
         suspension2Body.CreateFixture(fixtureDef);
         
         
         //Create the joints describing how the wheels are fixed to the suspension
         var jointDef:b2RevoluteJointDef = new b2RevoluteJointDef();
         jointDef.bodyA = suspension1Body;
         jointDef.localAnchorA = new b2Vec2(0, 0);
         jointDef.bodyB = wheel1Body;
         jointDef.localAnchorB = new b2Vec2(0, 0);
         jointDef.enableMotor = false;
         jointDef.motorSpeed = Math.PI * 20000;
         jointDef.maxMotorTorque = 1900;
         
         m_world.CreateJoint(jointDef);
         
         jointDef.bodyA = suspension2Body;
         jointDef.bodyB = wheel2Body;
         jointDef.enableMotor = false;
         
         m_world.CreateJoint(jointDef);
         
         
         //Create the joints describing how the suspension bodies are fixed to the chassis
         var suspensionJointDef:b2PrismaticJointDef = new b2PrismaticJointDef();
         suspensionJointDef.bodyA = chassisBody;
         suspensionJointDef.localAnchorA = new b2Vec2(
            -30 / m_physScale,
            40 / m_physScale
         );
         suspensionJointDef.bodyB = suspension1Body;
         suspensionJointDef.localAnchorB = new b2Vec2(
            0,
            0
         );
         suspensionJointDef.lowerTranslation= -0.5;
         suspensionJointDef.upperTranslation = 0.0;
         suspensionJointDef.localAxisA = new b2Vec2(0, 1);
         suspensionJointDef.enableLimit     = true;
         suspensionJointDef.maxMotorForce   = 30000;
         suspensionJointDef.motorSpeed      = 1;
         suspensionJointDef.enableMotor     = true;
         
         m_world.CreateJoint(suspensionJointDef);
         
         suspensionJointDef.localAnchorA = new b2Vec2(
            35 / m_physScale,
            40 / m_physScale
         );
         suspensionJointDef.bodyB = suspension2Body;   
         m_world.CreateJoint(suspensionJointDef);
         
      }
      
      
      //======================
      // Member Data
      //======================
   }
   
}


Oh and I tried the other things suggested in the topic above - increasing the wheel density and reducing the timestep - but it didn't seem to help.

Would somebody take a look please?

Thanks,

-Bob

P.S. the drive wheel is disabled in the test above so the juddering can be watched without the car shambling into the wall...

Original thread: https://box2d.org/forum/viewtopic.php?t=5100