代码之家  ›  专栏  ›  技术社区  ›  David

ShapeRender摄影机

  •  2
  • David  · 技术社区  · 11 年前

    我正在开发platformer游戏(900x700)。我想使用ShapeRender渲染矩形(敌人),但我看不到伦图。

        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);
                    }
        }
    

    我知道我需要将屏幕坐标转换为世界坐标。我尝试使用

    camera.unproject();
    

    但我需要 矢量3 作为论据。那么我如何获得Vector3?

    1 回复  |  直到 11 年前
        1
  •  3
  •   David    11 年前

    我知道答案。我需要使用 render.setProjectionMatrix(camera.combined); 一切都很好!:)