2

I'm working on platformer game (900x700). And I want to render rectangle (enemy) using ShapeRenderer but I don't see the renctangle.

    for(GameObject t : enemies){
                if(t instanceof Enemy){
                    t.update(Gdx.graphics.getDeltaTime());
                    render.rect(t.getHitBox().getX(), t.getHitBox().getY(), enemies.get(0).getHitBox().width, enemies.get(0).getHitBox().height);
                }
    }

I understand that somehow I need to convert Screen coords to World Coords. I try to use

camera.unproject();

But I need Vector3 as argument. So how can I get Vector3?

David
  • 3,055
  • 4
  • 30
  • 73

1 Answers1

3

I know the answer. I need to use render.setProjectionMatrix(camera.combined); and all works great! :)

David
  • 3,055
  • 4
  • 30
  • 73