0
如何在一個軸(x或y)中鏡像物體的固定裝置,因爲當我只想在一個鏡像中鏡像時,會發生斷言錯誤,但是當我鏡像它在兩個軸上,沒有問題發生。在box2d和libgdx中使用頂點構建的鏡體
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;
}
所以......斷言發生在哪裏? – iforce2d 2012-03-01 12:11:35