Collision in ParallaxLayer not working properly

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By gboi


I am facing the following issue:

The idea is that when a player enters a region the name of that area shows up

  • I have a ParallaxLayer where I put Area2D regions
  • (I enabled collisions in Debug mode so I can see where they are)
  • The area entered event triggered randomly (so the player doesn’t even have to be inside the area)

I think I may need to set properties on ParallaxLayer but I don’t know what. Even if the Motion/Scale set to 1 it doesn’t work the way I expect.

I have to use ParallaxLayer because the area should move along with the background in order to create the effect that the player actually in the area

I would be happy to hear other ideas as well to solve this problem

Can you share your code? I tried to replicate this and I couldn’t.

exuin | 2022-11-24 16:25

Sure, I share a minimal repro.
This is happening when I enable the camera.

  • First run the project without enabling the camera, everything is good (of course parallax layers are pointless without a camera).
  • Enable Visible Collision Shapes in debug
  • Now enable the camera by ticking the “current”
    Place the area2D objects to the following positions:
    (375, 172) and (645, 174) → run the project. You will notice 2 log outputs before the player actually hits the areas

Repro repo: GitHub - Vulcaine/godot_parallax_collision_repro

gboi | 2022-11-24 17:22

Hello, I also have this issue, collisions between a StaticBody2D inside a parallax2D and a CharacterBody2D outside don’t work properly. The collision is detected outside of the debug zones. Any updates on this matter?