Is there way to make two tilesets collide with each other?

Godot Version

4.2

Question

I have a platform (first tileset) that I can expand up and down and box (second tileset) placed on the platform. I want the box move with the platform. I added same physiscs layers (collision layer = 1, collision mask = 1) for both tilesets. But as you can see on the picture the box is not moving with the platform. Is it even possible to make it happen?

tilemapscollision

place the box as a child of the platform

Unfortunately it didnt work

can you tell me more about how you move the tileset?

sorry I didn’t get what you meant the first time.
you can make a RigidBody2D and make the box the child of the RigidBody2D

Dont worry. Yeah now the box is moving but falling through the platform like there is no collision.

add a collision shape to it
like CollisionShape2D > rectangle

Now its flying all over the place. Should CollisionShape2d be a child to RigidBox and Tilemap child of CollisionShape2d?

the collisionshape2d should be a child of the rigidbody2d

image
something like this

Well it is still flying upwards from the platform. So far I found that removing it with set_cell at the original position and placing with set_cell at new position works best. But I have a feeling that this is not the most efficient way.

I have a working demo here if you like to watch :

Cool. Did you wrote any script to it?

no only the moving script for the tilemap

WOuld you, please, provide me with your script? The set_cell function is not working the way I want after playing with it little bit more.

Here is the source code of the demo you can play around with it:
https://drive.google.com/drive/folders/1InmW1UnGZ5yqdBKW2Zpq_0EEkEWfNXei?usp=sharing

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.