+1 vote

I feel stupid for encountering this problem, but it appears that setting a Camera2D as the current camera effectively ignores the Transform Scaling of ParallaxLayers in a ParallaxBackground, while Motion Scaling works fine. What do I need to do to enable Transform Scaling without scaling the layers' children manually (or with gdscript)?

The Node hierarchy I am using generally looks like this (moving the camera in different positions in the hierarchy does not fix the issue):

O: SceneRoot
- <>: Camera2D
- []: ParallaxBackground
- - []: ParallaxLayer1
- - - O: Sprite
- - []: ParallaxLayer2
- - - O: Sprite

This simple issue is driving me crazy. Any help and explanations for this issue would be appreciated.

in Engine by (51 points)

2 Answers

+1 vote
Best answer

After receiving some help, I was shown a simple work-around to accomplish the scaling I wanted.

Add a child Control node, or any node that can be scaled, to a ParallaxLayer you would like to have scaled children, and add the Sprites (or other visual elements) to that Control node:

O: SceneRoot
- <>: Camera2D
- []: ParallaxBackground
- - []: ParallaxLayer
- - - O: Control
- - - - O: Sprite1
- - - - O: Sprite2

The Control node, when scaled, will change the scaling of its children as normal.

by (51 points)
+1 vote

According to this issue on github, https://github.com/godotengine/godot/issues/3987

ParallaxLayer does not allow you to change position and scale AFTER it
was added to the scene.

by (9,712 points)

Thanks for the response and pointing out the related issue!

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 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 webmaster@godotengine.org with your username.