Is it possible to use CollisionShape2D and "body_exited" on a ParallaxLayer node?

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

I have set up a detector to detect when the player moves through an area. I’m using an Area2D with CollisionShape2D and a “body_exited” signal on Area2D. This works wonderfully, until I try to place the detector as a child of a ParallaxLayer node.

I’ll set up the scene: I have a Node2D as the root node (we’ll call it Root), then a ParallaxBackground node with a ParallaxLayer as a child. The ParallaxLayer has a child Sprite which contains the ground/background texture.

Root [Node2D]
| → ParallaxBackground
|| → ParallaxLayer
||| → Sprite
| → Player
| → GroundHitbox (ignore)
| → PlayerDetector [Area2D] (1 connection)
|| → CollisionShape2D

When the detector is a child of Root (as it is above) it works perfectly. It will print a message (“player exited left/right”) when the player exits the detectors CollisionShape2D.

However, if I place the detector as a child of the ParallaxLayer (or it’s child Sprite) the detector’s detection area will be offset (i.e. the message will be printed when the player moves through an area to the left of the actual detector, but will do nothing when the player moves through the actual CollisionShape2D area.

The offset is amplified the farther away the detector is placed from the origin.

The detector works correctly when placed as a child of the ParallaxBackground node instead of the ParallaxLayer Node.

Is this a bug, or an incompatibility with ParallaxLayers? Or am I doing something wrong?

Additional Info:

  • The ParallaxLayer is not scaled at all and the ParallaxBackground has a BaseScale of 1 (basically no paramaters changed)
  • My goal is to get an infinite background by using two copies of the background Sprite and then “leapfrogging” them over each other to create the illusion of an infinite world. The detectors are meant to trigger this action. The reason for using ParallaxLayers is that I wish to do this for each of my parallax layers.