Closed timvancann closed 3 years ago
Hi, thanks for reaching out about this.
1. Interesting that a custom shape tile is colliding as if it was a full square. Maybe there are prefab overrides in the scene that are affecting the tiles? We can also talk about this more here if the problem is still hanging around.
2. In regards to slopes and rules, it's would not be possible to have rules dictate collision.
deepnight answered a similar question in the discord server a while back; If you wanted to have a block and a slope that can also mirror, then that would total to 3 intgrid values. One for the block and 2 for the 2 slopes one left and on right. The same logic applies for 30 degree slopes, which would add 4 extra intgrid values in this case. Each intgrid value would be considered its own unique shape.
It may be quite a bit of bloat and some extra rules work to account for the extra intgrid values for slopes, but it's the solution that I've seen deepnight recommend and so it's also the convention I personally follow as well.
Hope I've helped out, but feel free to post any more issues or ask any additional questions if needed 🙂
Hi, thanks for repying so quickly!
I checked a few things but couldn't find anything obvious (it's a fairly blank project with no prefabs). But I remembered that I duplicated the block LDtkIntGridTile
and changed it to a slope. I deleted it and created a newLDtkIntGridTile
, added the slope tile and the collisions worked as expected!
I'm fairly certain that, as you've suggested, something may have been lingering in cache somewhere that was messed up. In any case it's resolved now. I'll keep a close eye on if I can spot any predictable behaviour!
That is a clear answer. I wasn't aware that this was the prefered workaround. I'll follow that convention, thanks!
Here's the conversation in question, take it as you wish. But I saw deepnight do this so I can trust this. But maybe it's good to re-ask the question if his opinion had changed 🙂
I'm unsure if this is supported hence the issue. If it is supported please share how to use it in Unity.
In LDtk I have an IntLayer with a bunch of rules. There are 2 grid values:
0
: solid blocks1
: 45 degree angle slopesThis allows me to paint a level including slopes. The tileset is setup in such a way that tiles are mirrored, hence rules are also setup that way. Slopes both ascending and descending are then automatically painted in using a single rule (with mirror
x,y
enabled) on the grid value1
.In Unity I have to apply an
LDtkIntGridTile
to each of the grid values. On value0
it's easy. A single block with a square collision shape. For grid value1
I have a single 45 degree ascending slope with custom collision shape. But for the slopes I notice that 2 things are not working:LDtkIntGridTile
for each mirror-version of each non-block based tile.Is it true this is not supported, or am I missing something obvious?
How would that work with more complicated shapes? E.g 33.3 degree slopes spanning multiple tiles to reach to 1 block height?