Texture Atlas not rotating regions
See original GitHub issueHey!
I turned on rotation in TexturePacker, but I found that libgdx wasn’t rotating them back. Looking at the code, I think this condition is wrong:
TextureAtlas ln 378:
private Sprite newSprite (AtlasRegion region) {
if (region.packedWidth == region.originalWidth && region.packedHeight == region.originalHeight) {
if (region.rotate) {
Sprite sprite = new Sprite(region);
sprite.setBounds(0, 0, region.getRegionHeight(), region.getRegionWidth());
sprite.rotate90(true);
return sprite;
}
return new Sprite(region);
}
return new AtlasSprite(region);
}
Sure the widths and heights don’t match, then there is a chance it was rotated?
Issue Analytics
- State:
- Created 9 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Rotate Atlas Region Libgdx - java - Stack Overflow
"rotation" parameter is rotating the image always from "left bottom". Can i rotate "region" from region's center point with "batch.draw"? (Note: ...
Read more >TextureAtlas - Starling Framework Reference
getRotation(name:String):Boolean. If true, the specified region in the atlas is rotated by 90 degrees (clockwise). TextureAtlas ; getTexture(name:String):Texture.
Read more >Edit Texture Atlas - Live2D Manuals & Tutorials
Auto-layout allows for fixed magnification, rotation, and placement of non-overlapping meshes. This setting can be specified when creating a new ...
Read more >How to get texture region of atlas? - Godot Engine - Q&A
When using an atlas texture for sprite nodes, I've noticed that the texture of the node is not the region you selected, but...
Read more >Apply Regions as Texture Sprite Slices
Thanks. I found it. But using rotated sprites sometimes is not comfortable. For example, when the atlas updating with new textures. Some of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi!
From looking at your code I can see exactly what I was doing wrong. I was creating the sprites as you were but then I was using as texture regions so I was losing the rotation information!
What an idiot… Sorry for wasting your time…
Copied your image and the atlas file and it seems to work correctly for me…