Saturday, 15 June 2019

Android rotation matrix not rotating around a point

I have been researching how to rotate Bitmaps in android, the only one I could find was using a Matrix. This works for rotations under 90 degrees, but it seems every 90 degrees the rotation point wobbles. Heres my code, if you want me to post an image/gif HERE of the result please say so. Thank you for your help

    Matrix leftMat = new Matrix();
    leftMat.setRotate ((float) (debug),thrustWidth,0);
    Bitmap leftThruster = Bitmap.createBitmap (thruster,0,0, thruster.getWidth(),thruster.getHeight (),leftMat,true);
    leftThruster.setHasAlpha(true);
    canvas.drawBitmap(leftThruster,(int) (shipX +leftCords[0]),(int) (shipY+leftCords[1]-cameraY),null);



from Android rotation matrix not rotating around a point

No comments:

Post a Comment