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
Allow setting collisions for multiple tiles at once #1322
Comments
Also related to issue #1281, which suggests to move the collision editing out of a dialog and instead allow editing collision shapes of all tiles side-by-side. The two approaches seem not entirely compatible, unless maybe we would move to a mode where all collision info is displayed side-by-side, but there is still a separate view for editing the shapes, which would modify the info on all selected tiles. In any case, this will be something to do on the |
The nice thing about the separate view approach that you mentioned, is that you could have a zoomed in view for detailed editing of the collisions, while having a zoomed out view showing you the overall tileset, which ones you've missed and which ones you are editing, and how they all fit together. I think in that way they could work well together. Another thought: If you went with only the whole tilesheet view, then if you could create big collider objects across multiple tiles and have it split it up and assign it to all tiles that it touches individually, then if you grouped together all similar tiles on the tilesheet then you could assign them all at once, giving a similar functionality. For example put all solid tiles in one section and draw a big square across them, and group corner tiles together so you can just draw a diamond shape across all four of them, etc. |
It's a neat idea, but in this case the collision info should probably be stored as a single object group along with the tileset. But that doesn't work with image collection tilesets, nor would it allow collision info to be auto-adjusted when the tileset size is changed (I'm currently fixing that... #1315). I'll try to go with the separate view for editing collision info for now. |
Wondering if there's been any progress on this? Didn't see anything on the Roadmap and wondering if/how I could contribute maybe? |
@mwillson Well, at least the So, the best way to help is probably to take a stab at implementing it yourself. You're very welcome to try it and I'm available in case you have any questions. The tileset view already allows multiple tiles to be selected at once, and all selected tiles can be obtained from the TilesetDocument, but the collision editor only deals with the single "current tile". So that is where most of the work would need to be done. Also, please write about how you'd expect the behavior to be before you start. |
Thanks @bjorn for pointing me in the right direction. I'll clone the repo and look through that area of the code. And I'll try and come up with a small proposal about what to do based on my ideas + what you guys have talked about in this thread already. I was looking at Unity's new tilemap editor btw and I think it would be nice to make something like what they have that uses the tile geometry to auto-create the colliders. Perhaps some solution that allows that and ALSO custom widely-applied collisions would be nice. Anyway, I'll write out something a little more formal later |
Isn't that exactly what Tiled2Unity is doing? If there's something that could be improved in Tiled about this feel free to open an issue with some more details. Thanks for taking up this issue! |
If Tiled2Unity does this, I was unaware. I've been using it, and as far as I can tell, it only creates the Unity collider by combining the single tile collisions you've already specified in Tiled. And that's why this is an issue. Creating those 1 by 1 is a pain, especially in the many common instances when they should all be the same anyway. |
You said that Unity used the tile geometry to auto-create the colliders. I haven't personally used Unity so I thought what you meant was the way Tiled2Unity creates colliders from the "geometry" specified in the tile collision editor. But now I assume you mean that Unity analyses the tile image, and creates the collider geometry based on its transparent areas? That would certainly be a useful feature. |
Yes, that.s what I mean. Something to work on :) |
Here's what I was thinking would be easier to implement in the short term: Example User Flow |
…eferenced in this ticket: mapeditor#1322
…eferenced in this ticket: mapeditor#1322
I like your short-term idea @mwillson. |
…elected tiles Issue mapeditor#1322
…elected tiles Issue mapeditor#1322
* Added context menu entries to copy the selected tile collision objects to all selected tiles * Added action to add auto-detected collision box based on tile image Related to issue #1322. Co-authored-by: Thorbjørn Lindeijer <bjorn@lindeijer.nl>
The "short-term" solution started by @robinmacharg two years ago as #1960 has now been finished and merged to The change also added an quick action for setting a colliding bounding box based on the image contents (ignoring transparent pixels). For now I've decided to keep this issue open for a more intuitive long-term solution. |
Pardon, is this not in 1.4.3? I only have Duplicate and Remove in the context menu. |
@Ianuarius Yeah, as a new feature this change went into |
This is the approach I'd like to see. As cool as it seems to draw a single shape over multiple tiles, I think in practice it's just more potential for confusion. An individual collision editor would still be necessary for editing complex multi-object collisions and collisions that go outside the tile bounds, anyway. A live-updating display of all current collisions makes it easy to see how collisions line up and which tiles have or don't have collision, while still making it very clear exactly which tile(s) you're editing. It just leaves the question of how to tackle the fact that some of the tiles may already have other collisions, and what to do in the case of *removing collision objects. The approach OP described seems most intuitive to me. Here it is in unnecessary detail: Scan through all the tiles when the collision editor is enabled or when the tile selection is modified with the collision editor open.
The actual logic should have fewer branches in it than this list suggests, I separated/duplicated some functionally identical things just to make it easier to follow. It's really just:
Building the correspondence and unique lists would probably be a fairly heavy action, so ideally it should not be fully rebuilt every time the selection changes. Some ideas on updating this list dynamically, which would probably also work for building the initial lists:
|
Often a large number of tiles on a sheet will have exactly the same collision boundaries and properties (basic walls, platforms, etc). It would save a lot of time if collisions could be applied to multiple selected tiles in the Tile Collision Editor.
This would likely include a popup to warn the user that individual tile collision assignments would be overwritten.
Alternatively, maybe the default behavior could be to "add" the new collision to to the tiles rather than overwriting them, along with an option to clear the previous assignments from the selected tiles. This could work well if the dialog displayed all of the selected tile's collisions superimposed on each other (uneditable unless they all matched). Not sure about the usefulness versus complexity of this approach.
As discussed in this issue:
#5 (comment)
The text was updated successfully, but these errors were encountered: