This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+1 vote

Hello I just started using the Godot engine but i've worked with Unity for more than a year so i have a bit of experience with game dev.

I'm making a tile based game where the player checks the surrounding tiles using raycasts. I had a scene called "Door" to make the player go to the next level and it was working as aspected. (It was an area2d with a sprite and collision shape children). The player would check if the rascast was hitting something and if that thing was a Door instance using return obstacle is Door(I'm planning on refactoring this bit in the future to use groups)

The problem started when I decided to create an Interactable scene and then make other scenes inherit from it. This scene its just like the Door scene: An Area2D with a sprite and collision shape. However, the player does not detect any of the scenes that inherit from Interactable (TreasureChest and Portal) as well as the Door!

Player, Portal and TreasureChest colliders
(The Door is not in this image, that's the Portal)

There's and Enemy scene that also checks its raycasts hits for movement and it's behaving just like the player, ignoring both interactables. It also ignores the player when you are "on top" of the interactable and then you get the player, enemy and interactable in the same spot.

Player, Portal and Enemy in the same spot

What I have tried so far:

  • Checking if the raycasts where enabled, Collide With Areas checked and tried every combination of collision mask and layer.
  • Removing any tiles that where underneath the TreasureChest/Portal.
  • Changing size of the areas and raycasts.

The whole project can be found here:
https://github.com/SaviHex/ShellDungeon

Thank you so much for taking the time to read my giant question!

in Engine by (20 points)
edited by

1 Answer

0 votes
Best answer

Found the solution!
The problem was that I was changing the collision layer on the scene file (ie. TreasureChest.tscn) but those changes were not updating the instanced nodes on the main scene.

by (20 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.