Oh i think i found the error.
Try this one:
private const c:Number = 2*Math.PI/360;
private var mask:Pixelmask;
private var maskBitmap:BitmapData;
private var matrix:Matrix;
private var rotatedMask:BitmapData;
//the angle in grades. If want to use radiants, delete the constant c.
private function setRotation(angle:Number):void
{
matrix.rotate(angle * c);
rotatedMask = new BitmapData(width, height, 0xFFFFFFFF);
rotatedMask.draw(maskBitmap, matrix);
mask.data = rotatedMask;
}
maskBitmap = FP.getBitmap(Assets.MASK);
mask = new Pixelmask(rotateBitmap, 0, 0);
setRotation(0);
Also nitce that the rotated bitmap is an square. You can calculate it using pithagoras (with the width and height of the original image); or, in case that you can put your mask in a cercle, you can se the diameter of it as width and height. I recomend to calcualte it once and add it as a constant.
Note: Remember to set the Pixelmask contructor, the last 2 numbers should be changed to the numbers that you need.
Note 2: The image will rotate in the middle. If you want to set another rotation origin you’ll have to modify the matrix to do it. (only need to change it right after create it or in the constructor).
PD: The main error was that the rotatedMask was field with 0x00000000 (invisible black) and it should be filled with flat white (0xFFFFFFFF). Then i saw another error: the hitbox wasn’t updated.