Hello Defold forum!
Recently I started experimenting with Defold to build a tetris-like game.
I have a single tilesource and multiple tilemaps for pieces geometry (like one go for each piece type) and same tilemap is also set as corresponding collision object. All objects are set to kinematic, and share same script that is supposed to react to collision messages.
The graphics part works fine, but when it comes to collision detection, nothing seems to happen - no collisions being reported.
I checked examples, forum posts and docs, but couldn’t find similar setups, and It seems like the reason is that all GOs inherit same group from the tilesource, and then there’s no combination of masks vs groups that makes it disjoint sets. Is that right or maybe I’m just missing something?
Is there a way to make objects in the same group to collide with each other?
Maybe there’s a better setup for that scenario?
Thanks!
EDIT: tried to put every object into its own group in the tilesource, but it didn’t do much - couldn’t see any messages coming to the script
EDIT2: attached project tiles_collision_test.zip (18.2 KB)
Of course, just put the group name in the mask field on the collider.
A collider with group character and mask character will collide with other copies of it.
Can you maybe share some screenshots of your tilemap, objects, and colliders?
And also the on_message of the script where you expect the collision messages.
The screenshots show my attempt to separate 2 GOs into different groups, that unfortunately, didn’t work. Originally both tiles in the tilesource belonged to the same group, and both GOs had it in their mask
Hmm, there’s something else going on too. I’m not getting tilemap shape to tilemap shape colllisions to work… tilemap shape collision to a basic shape works as expected though.
that was so silly… thanks for spotting it.
But for some reason it doesn’t seem to work even with groups set up correctly.
Is using tilemaps for shape a good idea at all?