title: box2d library's collider isn't working properly
body: <p>The problem is on video, collision aren't working properly. Is there any solution or can i show the collision edges on window.</p>
  <p>the video: <a href="https://streamable.com/w96uff" rel="nofollow noreferrer">https://streamable.com/w96uff</a></p>
  <p>CreateGround Function</p>
  <pre><code>b2BodyDef BodyDef;
  BodyDef.position = b2Vec2(X / 30.f, Y / 30.f);
  BodyDef.type = b2_staticBody;
  b2Body* Body = World.CreateBody(&amp;BodyDef);
  
  b2PolygonShape Shape;
  Shape.SetAsBox(400 / 30, 50 / 30); // Creates a box shape. Divide your desired width and height by 2.
  b2FixtureDef FixtureDef;
  FixtureDef.density = 1.f;  // Sets the density of the body
  FixtureDef.shape = &amp;Shape; // Sets the shape
  Body-&gt;CreateFixture(&amp;FixtureDef); // Apply the fixture definition
  
  
  **CreateBox() Function**
  
  b2BodyDef BodyDef;
  BodyDef.position = b2Vec2(MouseX / 30, MouseY / 30);
  BodyDef.type = b2_dynamicBody;
  b2Body* Body = World.CreateBody(&amp;BodyDef);
  
  b2PolygonShape Shape;
  Shape.SetAsBox(16.0f / 30, 16.0f / 30);
  b2FixtureDef FixtureDef;
  FixtureDef.density = 1.0f;
  FixtureDef.friction = 0.7f;
  FixtureDef.shape = &amp;Shape;
  Body-&gt;CreateFixture(&amp;FixtureDef);
  </code></pre>
  <p>While window is open loop:</p>
  <pre><code>for (b2Body* BodyIterator = World.GetBodyList(); BodyIterator != 0; BodyIterator = BodyIterator-&gt;GetNext())
          {
              if (BodyIterator-&gt;GetType() == b2_dynamicBody)
              {
                  sf::Sprite Sprite;
                  Sprite.setTexture(WoodTexture);
                  //Sprite.setOrigin(32.f, 32.f);
                  Sprite.setPosition(30 * BodyIterator-&gt;GetPosition().x, 30 * BodyIterator-&gt;GetPosition().y);
                  Sprite.setRotation(BodyIterator-&gt;GetAngle() * 180 / b2_pi);
                  Sprite.setTextureRect(sf::IntRect(0, 0, 32, 32));
                  gameWindow.draw(Sprite);
              }
              else
              {
                  MetalGround.setOrigin(400.f, 15.f);
                  MetalGround.setPosition(BodyIterator-&gt;GetPosition().x * 30, BodyIterator-&gt;GetPosition().y * 30);
                  MetalGround.setRotation(180 / b2_pi * BodyIterator-&gt;GetAngle());
                  gameWindow.draw(MetalGround);
              }
          }
  </code></pre>
  <p>EDIT:
  Okey okey i fixed the rolling thing but one more thing to done:</p>
  <p><a href="https://streamable.com/dgpawo" rel="nofollow noreferrer">https://streamable.com/dgpawo</a>
  as you can see the boxes doesn't stay still, they are sliding too much.</p>