godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.34k stars 21.06k forks source link

Moving platform with tilemap does not working properly #35550

Closed fabriceci closed 3 years ago

fabriceci commented 4 years ago

**Godot version: OS/device including version:** 3.1 & 3.2 - MAC/WIN

Issue description: movingTilemap.zip

Similar to what happened with a KinematicBody2D on a platform before 3.1, there are issues when the platform has a Tilemap (as collisions):

screenshot

I tried different setup in the demo project, but nothing works.

Edit: My assumption is, it should work with "use parent" on the tilemap (but I'm not sure)

madmiraal commented 4 years ago

It's unclear to me what the issue is. What do you mean by "not working"? What is the current behaviour? What is the expected behaviour?

If there are multiple issues, you should close this issue and create a separate issue for each problem, together with a minimal reproduction project clearly demonstrating that one problem. Also, you should upload images, example projects, etc. directly to Github instead of using links to external storage providers.

fabriceci commented 4 years ago

It's unclear to me what the issue is. What do you mean by "not working"? What is the current behaviour? What is the expected behaviour?

If you want a body follows (without moving) properly a platform in 3.1, you need to check the "sync to physics" box. But like in KinematicBody3D, there is not "sync to physics" checkbox on Tilemap, so I tried different setups.

If this is the Godot's proper way to deal with moving plateform, maybe the issue should be renamed "Add sync to physics checkbox to Tilemap/GridMap" [edit: it's a possible solution but the existing "use parent" should be enough.]

madmiraal commented 4 years ago

Add sync to physics checkbox to Tilemap/GridMap

That would make this a feature request and not a bug. Feature requests should be made here.

bojidar-bg commented 4 years ago

You can probably use some StaticBody2D/KinematicBody2D with sync to physics, then put the TileMap as a child and turn on "use parent" for collisions. I'm afraid there isn't a similar workaround for GridMaps, however.

fabriceci commented 4 years ago

That would make this a feature request and not a bug.

I do not agree, that's a possible solution not a new feature. Furthermore, I forgot the existence of the "use parent" checkbox used in the setup n°4, this option should act like the parent (KinematicBody2D with sync to physics), but it doesn't.

If I'm wrong, feel free to close the issue.

You can probably use s...

@bojidar-bg It's already tested in my setup n ° 4

The workaround I found is to actually not use the __physicsprocess function for kinematic bodies, but instead keep them in a list in the scene node, and "update" them in the right order. In case of a collision with the platform apply the platform velocity to the player. It's working but it's restrictive / heavy.

pwnorbitals commented 4 years ago

According to my understanding the setups 2 and 4 should work.

setup 4: physics issue?
setup 2 : I think the Tilemap needs the motion parameter: sync to physic (in kinematic mode).

This sounds like two different issues, one being a feature request

fabriceci commented 4 years ago

@pwnorbitals I think it is not necessary to have a sync to physics after all, because there is already a "use parent" checkbox.