Java – libGDX texturepacker rotation

libGDX texturepacker rotation… here is a solution to the problem.

libGDX texturepacker rotation

I’m using the TexturePackerPro program to package the sprite into a .pack file and use it in libGDX.
There is a rotate: true flag on some sprites, but when I read sprites in libgdx, the sprites do not rotate.

  rotate: true
  xy: 425, 1066
  size: 59, 96
  orig: 59, 96
  offset: 0, 0
  index: -1 

Why doesn’t sprite spin itself when the spin flag is set to true? If I have to rotate manually when drawing, why is there a rotation flag?

Thanks

Solution

The sprite is not rotated because libgdx is spinning your texture area back to its original rotation.

Why? The rotate flag simply tells how the textures in the package file are oriented, not how you want the image to be oriented after the region is loaded. Libgdx assumes that you want all images to be upright.

Related Problems and Solutions