0 votes

I have a main 2D scene with a zoom in of a ship and a zoomed in space background. In a viewport inside that scene I have the spaceship zoomed out with a camera2D following it in front of a zoomed out space background. Is there any way to make it appear as if the former background is synced up with the latter so that flying the spaceship/moving the camera in the viewport causes the background in the main scene to move appropriately?

Godot version 3.2.2
in Engine by (12 points)

1 Answer

0 votes

Sounds like you'll want to use the ParallaxBackground node and leave both backgrounds you have as children of it.

Basically, you add a ParallaxBackground node to the scene, then a ParallaxLayer. If you want the background to move at the same speed as the camera, leave the ParallaxLayer's Motion -> Scale values at 1. Lower numbers will make the background move slower, as if it was farther away.

The ParallaxBackground can have N ParallaxLayers, each with its own parameters and textures.

This video will probably help you understand it better: https://www.youtube.com/watch?v=7-zDftycdw8

by (292 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 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.