question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BaseTmxMapLoader ignores rotation for Objects

See original GitHub issue

Please ensure you have given all the following requested information in your report.

Issue details

The BaseTmxMapLoader is supports loading of map objects since #3751. I’m not 100% sure, if this is a bug, but I feel like that.

When setting the rotation on a map object in Tiled Map Editor, it is only add as property to the final MapObject (e.g. Polygon or Rectangle) but the object is not really rotated.

https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/maps/tiled/BaseTmxMapLoader.java#L383

Reproduction steps/code

You can find a simple demo of the problem here: https://github.com/deveth0/libgdx_tiledMapObjectRotationDemo

Basically I added some Tile where the left side of the tile is covered by a Rectangle which is rotated by 90°.

expected expected_props

For simplicity i used a Rectangle here, but this is also an issue for Polygons. Only TiledMapTileMapObject seem to be rotated correct (https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/maps/tiled/BaseTmxMapLoader.java#L376)

Version of LibGDX and/or relevant dependencies

gdxVersion = '1.9.11'

Please select the affected platforms

  • Android
  • iOS (robovm)
  • HTML/GWT
  • Windows
  • Linux
  • MacOS

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
mgsx-devcommented, Sep 9, 2020

@deveth0 the thing is rotation can be arbitrary (other than 90° angle) and some underlying shapes (Rectangle and Ellipse) doesn’t have rotation conceptually.

TiledMapTileMapObject holds a rotation field for convenience but the underlying “shape” (texture region) doesn’t have rotation for the same reason.

About Polygon and Polyline, shapes could be rotated directly but it would break consistency with other shapes.

I understand it’s not a perfect design but i think it’s user code responsibility to apply rotation to their final game object (TiledMapTileMapObject is typically a Sprite, RectangleMapObject could be a box2D body, and so on).

If you’re OK with that, you can close the issue.

0reactions
mgsx-devcommented, Feb 18, 2021

I guess there is no further debate, i’m closing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to handle tile rotation in pytmx? - python - Stack Overflow
I am loading a map from Tiled with pytmx, but when i draw the tiles, they aren't rotated like in the editor. The...
Read more >
Chapter 1 Rotation of an Object About a Fixed Axis
As a rotating object moves through an angle θ from the starting position, a mass point ... ignore friction in the bearings) and...
Read more >
Index (gdx 1.11.0 API) - Javadoc.io
The key which must be pressed to activate rotate, translate and forward ... Adds the specified object to the end of the list...
Read more >
Ignore parent rotation - Blender Stack Exchange
The remaining light - the one selected in the picture - is parented to the coin. I want this light to move along...
Read more >
Can a shader make a texture ignore rotation ... - Unity Answers
Ordinarily this would be done in object space to avoid this effect, however it's easy enough to do a world space one. For...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found