title: Drag And Drop LibGDX
body: <p>I want to make a game where you can build stuff by dragging and dropping objects into place. I think LibGDX only supports DragNDrop on Actors, but I need physics on bricks in order to make them fall down if the construction is not stable.</p>
  
  <p>So far, my approach to drag and drop is:</p>
  
  <pre><code>for(Brick b : map.getList()){
  
          final Image im = new Image(b.ar);
  
          stage.addActor(im);
          im.setPosition(b.posX, b.posY);
          im.setOrigin(b.posX, b.posY);
  
          im.addListener((new DragListener() {
              public void touchDragged (InputEvent event, float x, float y, int pointer) {
                      im.setOrigin(x, y);
                      im.setPosition(x, y);
                      //System.out.println("touchdragged ---&gt; X=" + x + "  , Y=" + y);
  
  
                  }
  
              }));
      }
  </code></pre>
  
  <p>where the map.getLists contains all bricks to be painted. b.ar is the texture to be painted. </p>
  
  <p>With this aproach <a href="http://v5.tinypic.com/player.swf?file=330b9g5&amp;s=5" rel="nofollow">[this]</a> is what happens. I don't know what may be causing it. </p>
  
  <pre><code>@Override
  public void render(float delta) {
      spritebatch.begin();
          map.getWorld().step(1/60f, 6, 2);
          renderer.render(map.getWorld(), camera.combined);
  
          if(Gdx.input.justTouched()){
              Vector3 touchPoint = new Vector3(Gdx.input.getX(), Gdx.input.getY(),0);
              camera.unproject(touchPoint.set(Gdx.input.getX(), Gdx.input.getY(), 0));
  
              System.out.println(touchPoint);
          }
  
  
          stage.draw();
      spritebatch.end();
  }
  </code></pre>
  
  <p>Of course i'd like to make the body fell (with the box 2d engine from libgdx) if you drop the object and it has nothing under it.</p>
  
  <p>Thanks in advance </p>