相机旋转问题Libgdx

时间:2014-08-29 23:02:12

标签: java android camera rotation libgdx

我有一个OrthographicCamera,我想要旋转90°,但是当我旋转时,它似乎向右移动了更多。

轮换前: http://postimg.org/image/4ojldia8t/

轮换后:http://postimg.org/image/dul66z2rv/

设置相机是这样的:

在create方法中:

//map is an object of my personal class that wraps tiledmap class
this.renderer=new OrthogonalTiledMapRenderer(this.map.getMap());
this.camera=new OrthographicCamera(Gdx.graphics.getWidth(),Gdx.graphics.getHeight());
this.camera.translate(mappa.getMapPixelWidth()/2, mappa.getMapPixelHeight()/2);
this.camera.update();
view=new StretchViewport(map.getMapPixelWidth(),map.getMapPixelHeight(), camera);
flag=false;

在渲染方法中:

if(!flag) {
   flag=true;
   camera.rotate(90);
}

this.renderer.setView(this.camera);
this.renderer.render();
this.camera.position.y+=1;
this.camera.update();

这是错的吗?

感谢您的时间

0 个答案:

没有答案
相关问题