Skip to content
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

One-way collisions in tilemap can't be modified after the game has been started once #53801

Open
Tracked by #45334
svprdga opened this issue Oct 14, 2021 · 9 comments
Open
Tracked by #45334

Comments

@svprdga
Copy link

svprdga commented Oct 14, 2021

Godot version

3.3.4 stable faf3f88

System information

Linux Mint, GLES3/GLES2, GeForce GTX 1070/PCIe/SSE2

Issue description

It seems like one-way collisions for single tiles in a Tilemap does not work. A kinematic body 2D can't go through from any direction.

Steps to reproduce

  1. Create a Tilemap
  2. Add a TileSet
  3. Create a single tile
  4. Set to true the selected_collision_one_way property
  5. Try to go through it with a kinematic body controlled by code

Minimal reproduction project

godot-issue-53801-master.zip

@pouleyKetchoupp
Copy link
Contributor

Please provide a minimal reproduction project to help contributors investigate your issue.

@svprdga
Copy link
Author

svprdga commented Oct 15, 2021

Hi @pouleyKetchoupp ,

I was preparing a sample project and I have discovered that in the new project it works as expected. I have tried to investigate more to try to find the issue and I found that if I check the one way collision property, save, close the editor, come back; then the property is disabled again.

Also, I have found the following error in the output window that might be related:

The TileSet doesn't have a tile with ID '0'.

@pouleyKetchoupp
Copy link
Contributor

I can't reproduce the issue or the error with a new project in 3.3.4. Could you please provide us with the project you're using where you can reproduce the issue as you just described, and the exact steps based on this project?

@svprdga
Copy link
Author

svprdga commented Oct 16, 2021

@pouleyKetchoupp I wish I could share the problematic project but it contains proprietary assets that I can't distribute.

I've found a way to circumvent the error, it seems like the problem is that the property is not being correctly saved, but if I perform the following steps the majority of the times I could set them as one-way collisions:

  1. Select the tile that I want as one way collision
  2. Enable one-way collision
  3. Save the project
  4. Select another tile
  5. Save the project
  6. With the other tile selected, go to the Region tab in the TileSet panel
  7. Save the project

Most of the times that I did the above I could set them as one-way collisions. There were also times where I had to restart the editor.

@Zireael07
Copy link
Contributor

@svprdga: Can you strip the affected project down (i.e. remove the proprietary assets entirely or replace them with some placeholders, i.e. a generic cube instead of a model, etc.) to create a MRP?

@svprdga
Copy link
Author

svprdga commented Oct 16, 2021

Okay...I think I've got it: https://github.com/svprdga/godot-issue-53801

Instructions:

  1. Open the project, climb to the top of the left thing (jump with space, you can double jump)
  2. Try to climb to the upper platform, these tiles have one-way collision enabled

From this point, you can try:

  • To disable their one-way collisions
    1 Click in TileMaps>Solid in the scene panel, open the Tileset, the most upper left tiles are the ones with one-way collision enabled
  1. Try to disable their one-way collision. When I try it I can't change the parameter, the player can still go through it.
  • To enable one-way collisions in another tile
  1. Select another tile and enable their one-way collision
  2. Place it instead of the current platform

@pouleyKetchoupp
Copy link
Contributor

@svprdga Thanks for the test project, I can reproduce the issue in 3.3.4, and also 3.4 RC1. It's not just one-way collision, if I change anything in the tile set after I started the game once, like the collision shape, it's not reflected after saving, until I restart the editor.

It does work normally though if I just load the project, make the change and start the game.

I've updated the PR description with a zip file of your project for convenience.

@pouleyKetchoupp pouleyKetchoupp changed the title One-way collisions in tilemap is not working One-way collisions in tilemap can't be modified after the game has been started once Oct 21, 2021
@pouleyKetchoupp
Copy link
Contributor

CC @groud just in case you have an idea what could be the problem, since you've worked on refactoring tilemaps. I haven't investigated or tested in 4.0 so far.

@duianto
Copy link

duianto commented Feb 15, 2022

The issue seems to be that the tileset has to be saved manually.

After toggling Selected Collision One Way

  • In the Inspector dock.
  • Click on the floppy disk icon at the top, (mouse over tooltip; Save the currently edited resource.)
  • And choose: Save from the dropdown list.

Reproduced with the Minimal reproduction project: godot-issue-53801-master.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants