java - IsometricTiledMapRenderer Box2d Collision Detection MapObject -
i trying render isometric tiled map, example if use orthogonaltiledmaprenderer
orthogonal tiled map box2dobjects/bodies
rendered perfect following code initialize 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]; (int = 0; < 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 working perfect -->>
but if try use isometrictiledmaprenderer
, run debug mode:on
, have following issue :
but don't want mapobjects orthogonal!
Comments
Post a Comment