Search code examples
androidmatrixcollision-detection

Android - Setting bitmap collision detection after rotation by matrix


How do I create code for collision detection on a bitmap rotated by a matrix?

canvas.drawBitmap(mAnimation, mainMatrix, null);

mainMatrix is derived from a PathMeasure so i do not know the rotation The bitmap is rotated around x=0,y=0 and thus a circle around the centre will not work (or at least be too big)

thanks


Solution

  • Matrix has a method to map points and rectangles, you could use that to know the result of the transformation.