0
所以我有這個方法....反轉方法?
public static Vector2 cellsToIso(float row, float col) {
float halfTileWidth = tileWidth *0.5f;
float halfTileHeight = tileHeight *0.5f;
float x = (col * halfTileWidth) + (row * halfTileWidth);
float y = (row * halfTileHeight) - (col * halfTileHeight);
return new Vector2(x,y);
}
,我要到反向方法isoToCells(float x, float y)
我想這一點,但它沒有任何意義,我
public static Vector2 isoToCell(float x, float y) {
float halfTileWidth = tileWidth * 0.5f;
float halfTileHeight = tileHeight * 0.5f;
float row = (y/halfTileWidth) - (x/halfTileWidth);
float col = (x/halfTileHeight) + (y/halfTileHeight);
return new Vector2(row,col);
}
請說明您的具體問題或添加其他詳細信息,以確切地突出顯示您的需求。正如目前所寫,很難確切地說出你在問什麼。 –
你爲什麼要嘗試一些對你沒有意義的事情? – shmosel