-
-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restore lost ability to rotate the navigation + physics layers of tilemaps #4949
Comments
My hacky branch can be seen here: |
PS I am sure I remember seeing a discussion on this very long thread: #1769 where other people were requesting this feature, but I just went back and can't find it anymore so maybe I hallucinated it, ha ha |
Hey apologies, I should have searched before posting definately related to #5158. I wasn't aware of the use of alternative tiles, investigated creating them and changing the physics layers via GDScript, however it seems you can't actually get a reference to the polygon points like you could in v3.4 (or I just havent looked hard enough yet) Are you able to still work on this @halgriffiths? I'm new to the Godot source but can help with any testing that needs to be done. This branch looks great and would definately be very useful to have this in before the 4.0 beta. |
Yeah, thats correct. The way I do it instead is I get a reference to the parent TileData, and then duplicate the parent's polygon points. In theory this is inefficient, but since TileSet editing would (presumably) be done in-editor and not during runtime, it seemed to me like an acceptable cost to pay. Its a bit hard to navigate my branch coz I haven't made a PR yet (waiting for maintainer feedback on this proposal), but if you are curious, then this |
If anyone can't easily build the modified branch, and this doesn't make it into the 4.0 beta, I've written a routine to automatically create transformed alternative tiles along with their physics layers via GDScript: Attach the script to your TileSet either in the editor or in your TileMap script:
This will save a copy of your tileset with the alternatives to a new .tres file. The problem with this is it creates quite a lot of alternative tiles: This makes me wonder if transform functionality might be better built in as a flag when placing tile on the TileMap and exposed to the relevant functions as well. I think the comment by @KingBrainlord in related #3967 is worth quoting here:
Could we get some feedback from the maintainers of the new TileMap/Set implementations and what their thoughts on restoring this functionality is? @Calinou ? |
Per-tile rotation effectively solves the issue reported here and was implemented in 4.2, closing. |
Describe the project you are working on
A 2D tile-placing game with navigation polygons and collision boxes on each tile.
Describe the problem or limitation you are having in your project
In Godot 3.x, I could create one tile with collisions etc, and then use the rotate keys to make all 4 orientations.
When I hit the rotate button, not only did the texture rotate, but so did all the collision and navigation polygons as well.
In Godot 4.0 the new TileMaps system by @groud is excellent but has regressed and lost this functionality. In Godot 4.0 when you rotate a tile (now done via the Alternative Tiles system), only the texture is rotated and the collision/navigation information is unaffected.
Furthermore, when you create an alternative tile from a pre-existing tile, all collision information is similarly lost, so instead of just pressing a "rotate" button to generate a new tile, I would have to:
Not to mention that every time I update the polygons of the original tile I would have to go and manually update the 3 other alternative tiles as well.
This is a significant interuption to my workflow, and it is a shame that this previously very useful feature is disappearing - I sont be able to move my project onto 4.0 unless it is added back.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
The feature would add two checkbox toggles to the Alternative Tile Editor panel:
When these checkboxes are enabled, for either the navigation polygons or physics polygons:
If the checkboxes are disabled (perhaps they could be disabled by default) then behaviour would be unchanged.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
I have actually already implemented this, in a hacky and ugly way! I am happily using it myself on a custom build of Godot, and am only making this proposal to see if it is worth the effort to go back and clean it up so it can be submitted in a merge-able state.
Some GIFs of it working:
Alternate tiles duplicate existing collision layers on creation
Rotating alternate tiles rotates the collision layers too
Implementation details
The way I implement it is like this:
There is still work to do, if I want to convert my personal hack into a proper feature:
Currently only navigation polygons work, I haven't implemented the physics ones yetThis is now done!Something I am concerned about is timelines - I know that there will be a feature freeze for beta, so I am keen to try and squeeze this in for 4.0 if I can.
If this enhancement will not be used often, can it be worked around with a few lines of script?
if this feature is part of a users workflow, they will be using it very often (as I have been)
Is there a reason why this should be core and not an add-on in the asset library?
This is an integral part of the TileMaps system which is restoring functionality that already exists in 3.x
The text was updated successfully, but these errors were encountered: