So i have this problem when rotating entities in my program. It seems some tiles are omitted from the rotation in any degree value that is not 90,180,270, or 360. Which I kinda expected, but I can’t figure out how to fix it. ???
http://zippy.gfycat.com/UnlawfulWelcomeAnteater.gif
I am rotating a 2d array of tiles:
for (int x = 0; x < texture.getTexture().getWidth(); x++) {
for (int y = 0; y < texture.getTexture().getHeight(); y++) {
Vector2 rotate = rotate(new Vector2(x-width/2,y-height/2));//Rotate points about center
float x1 = Math.round(rotate.x+width/2);//round and translate
float y1 = Math.round(rotate.y+height/2);//round and translate
Tile t = Game.get(this.rx / Tile.gridSize + x1, this.ry
/ Tile.gridSize + y1);//get grid tile
Color c = texture.pixelData[x][y];//get grid color
if (c.a > 0 && t != null) {
t.type = Type.BLOCKED;//make sure tile is solid
t.r1 = c.r;//assign color to tile
t.g1 = c.g;
t.b1 = c.b;
}
within[x][y] = t;//assign tile to list
}
}
rotation method:
public Vector2 rotate(Vector2 point){
return point.rotate(rotation);
}
Any help would be awesome!