0 votes

I have modeled the split screen platform demo to support split screen for my game.
I have a scene that allows a player to fly around as a spaceship. When I make use of that scene with the split screen viewports everything mostly works, however with one issue i'm not able to figure out: When the window resizes, the camera center stays the same and doesn't adjust to the new window size.

Can someone please provide me some guidance on how to recenter the camera to the new windows/viewport size?

Thank you.

in Engine by (12 points)

1 Answer

0 votes

You can always monitor the root viewport using it's resize signal. Then calculate what you need from that. It depends though a lot on how you have your project setup, the implementation is up to you.

A simple example:

func _enter_tree():
    get_tree().get_root().connect("size_changed", self, "resized")

func resized():
    # Do resizing calculations here using new size information.
by (5,190 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.