Jovan
Jovan

Reputation: 4794

libGDX texturepacker rotation

I'm using TexturePackerPro program for packing sprites in to .pack file and use it in libGDX. On some sprites there is rotate: true flag but when I read sprite in libgdx sprite is not rotated.

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

Why sprite didn't rotate it self when rotate flag is set to true ? If I must to rotate manually when drawing, then why there is rotate flag?

Thanks

Upvotes: 4

Views: 1719

Answers (2)

Neerkoli
Neerkoli

Reputation: 2695

You have to use Sprite or AtlasSprite to get the rotation properties. TextureRegion or AtlasRegion doesn't consider rotation. If you are converting it into a Drawable, use SpriteDrawable.

Upvotes: -1

William Morrison
William Morrison

Reputation: 11006

The sprite isn't rotated because libgdx is rotating your texture region back to its original rotation.

Why? The rotate flag is there just to tell how the texture in the pack file is oriented, not how you want your image oriented after the region is loaded. Libgdx assumes you want all images oriented upright.

Upvotes: 4

Related Questions