I am trying to render isometric tiled map, for example if I use OrthogonalTiledMapRenderer
for Orthogonal Tiled Map The box2dObjects/bodies
are rendered perfect following code for initialize the MapObjects
:
if (object instanceof RectangleMapObject) {
RectangleMapObject rectangleObj = (RectangleMapObject)object;
Rectangle rectangle = rectangleObj.getRectangle();
position= new Vector2((rectangle.x+rectangle.getWidth()*0.5f)/Game.SCALE_PIXELS_ToMETERS, (rectangle.y+rectangle.getHeight()*0.5f)/Game.SCALE_PIXELS_ToMETERS);
size= new Vector2(rectangle.getWidth()/Game.SCALE_PIXELS_ToMETERS, rectangle.getHeight()/Game.SCALE_PIXELS_ToMETERS);
PolygonShape polygon = new PolygonShape();
polygon.setAsBox(rectangle.width * 0.5f / Game.SCALE_PIXELS_ToMETERS,rectangle.height * 0.5f / Game.SCALE_PIXELS_ToMETERS);
shape=polygon;
}
else if (object instanceof PolygonMapObject) {
PolygonMapObject polygonObj = (PolygonMapObject)object;
PolygonShape polygon = new PolygonShape();
float[] vertices = polygonObj.getPolygon().getTransformedVertices();
float[] worldVertices = new float[vertices.length];
for (int i = 0; i < vertices.length; ++i) {
worldVertices[i] = vertices[i] / Game.SCALE_PIXELS_ToMETERS;
}
polygon.set(worldVertices);
shape=polygon;
position=null;
}
else if (object instanceof PolylineMapObject) {
PolylineMapObject polyLineObj = (PolylineMapObject)object;
Polyline polyLine=polyLineObj.getPolyline();
position= new Vector2(polyLineObj.getPolyline().getX(),polyLineObj.getPolyline().getY());
//vector=scaleToMeters(vector,polyLine.getLength(),polyLineObj.height);
shape = getPolyline((PolylineMapObject)object);
}
else if (object instanceof CircleMapObject) {
CircleMapObject circleObj = (CircleMapObject)object;
Circle circle = circleObj.getCircle();
CircleShape circleShape = new CircleShape();
circleShape.setRadius(circle.radius / Game.SCALE_PIXELS_ToMETERS);
circleShape.setPosition(new Vector2(circle.x / Game.SCALE_PIXELS_ToMETERS, circle.y / Game.SCALE_PIXELS_ToMETERS));
position= new Vector2(circle.x,circle.y);
shape = circleShape;
}
Entity entity=null;
if(object.getName().equals("StaticWall")) entity=createStaticWallObject(shape,object.getName(),object,position);
if(entity!=null) dynamicEntitys.add(entity);
and everything Working perfect -->>
but if I try to use IsometricTiledMapRenderer
and run it with debug mode:on
, I have the following issue :
but I don't want the mapobjects to be Orthogonal!