Prismatic Joint

I'm noticing something odd with the Prismatic joint. I modified the test bed example to illustrate my problem. Add this example to the test bed:

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.*;

   public class TestCrankGearsPulley extends Test{
      
      public function TestCrankGearsPulley(){
         
         // Set Text field
         Main.m_aboutText.text = "Joints";
         
         var ground:b2Body = m_world.GetGroundBody();
         
         var body:b2Body;
         var sd:b2PolygonShape;
         var bd:b2BodyDef;
         var fixtureDef:b2FixtureDef = new b2FixtureDef();
         
         bd = new b2BodyDef();
         bd.type = b2Body.b2_dynamicBody;
         bd.position.Set(0,0);
         
         sd = new b2PolygonShape();
         sd.SetAsBox(22.5 / m_physScale, 22.5 / m_physScale);
         fixtureDef.shape = sd;
         bd.position.Set(100.0/m_physScale, 180/m_physScale);
         body = m_world.CreateBody(bd);
         body.CreateFixture(fixtureDef);
         
         var pjd:b2PrismaticJointDef = new b2PrismaticJointDef();
         pjd.Initialize(ground, body, new b2Vec2(100.0/m_physScale, 180/m_physScale), new b2Vec2(1.0, 0.0));
         
         pjd.maxMotorForce = 500.0;
         pjd.enableMotor = true;
         pjd.lowerTranslation=-1;
         pjd.upperTranslation=1;
         pjd.enableLimit=true;
         
         m_joint2 = m_world.CreateJoint(pjd) as b2PrismaticJoint;
         
         // Create a payload
         sd = new b2PolygonShape()
         sd.SetAsBox(22.5 / m_physScale, 22.5 / m_physScale);
         fixtureDef.shape = sd;
         fixtureDef.density = 2.0;
         bd.position.Set(100.0/m_physScale, (50)/m_physScale);
         body = m_world.CreateBody(bd);
         body.CreateFixture(fixtureDef);
         
      }
      
      //======================
      // Member Data
      //======================
      private var m_joint1:b2RevoluteJoint;
      private var m_joint2:b2PrismaticJoint;
      
      public var m_gJoint1:b2RevoluteJoint;
      public var m_gJoint2:b2RevoluteJoint;
      public var m_gJoint3:b2PrismaticJoint;
      public var m_gJoint4:b2GearJoint;
      public var m_gJoint5:b2GearJoint;
      
   }
}


First of all it seems like the prismatic joint isn't moving along the right axis. It should be moving along the x-axis correct? Now try dragging the top body(no joint attached) and drag it so it collide's with the body attached to the prismatic joint. The body attached to the prismatic joint moves off it's axis. Finally the limits don't seem to be working either. Perhaps I'm just totally confused about how limits work.

Thanks,
Bryan
You've made a dynamic body of zero mass. Give the fixture a +ve density.
LOL, such as small thing can make such a difference =) Thanks Boris that was it!

-Bryan

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