【发布时间】:2012-03-18 06:52:14
【问题描述】:
如何在一个轴(x 或 y)上镜像一个物体的夹具,因为当我只想在一个轴上镜像它时,会发生断言错误,但是当我在两个轴上镜像它时,不会出现问题.
public Vector2[][] getPolygons(String bodyName, float scaleX, float scaleY)
{
Vector2[][] vectors = null;
Element fixture;
Element semiPolygon;
float auxX, auxY;
this.element = reader.parse(xml);
fixture = this.element.getChildByName(bodyName);
vectors = new Vector2[fixture.getChildCount()][];
for(int child = 0; child < fixture.getChildCount(); child++)
{
semiPolygon = fixture.getChild(child);
vectors[child] = new Vector2[semiPolygon.getChildCount()];
for(int part = 0; part < semiPolygon.getChildCount(); part++)
{
auxX = semiPolygon.getChild(part).getFloatAttribute("x")*-scaleX;
auxY = semiPolygon.getChild(part).getFloatAttribute("y")*-scaleY;
vectors[child][part] = World.toGameCoordinates(auxX, auxY);
}
}
return vectors;
}
【问题讨论】:
-
所以...断言发生在哪里?
标签: java libgdx box2d mirroring