Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera2D::get_screen_center_position() affected by rotation #83372

Closed
awardell opened this issue Oct 15, 2023 · 1 comment
Closed

Camera2D::get_screen_center_position() affected by rotation #83372

awardell opened this issue Oct 15, 2023 · 1 comment

Comments

@awardell
Copy link
Contributor

Godot version

v4.2.beta.custom_build [b137180], v4.1.2.stable

System information

Godot v4.2.beta (b137180) - Windows 10.0.19045 - GLES3 (Compatibility) - NVIDIA GeForce GTX 1080 Ti (NVIDIA; 31.0.15.3623) - AMD Ryzen Threadripper 1950X 16-Core Processor (32 Threads)

Issue description

The Vector2 returned by Camera2D::get_screen_center_position() is (incorrectly) affected by the camera's rotation. Rotating the camera will cause get_screen_center_position to return different values, despite the actual center being in the same place.

Steps to reproduce

  1. Rotate a camera to non-identity.
  2. get_screen_center_position returns incorrect values.

Minimal reproduction project

In this example project there are two scenes with similar setups.
One Sprite, colored red, follows the Camera2D's get_screen_center_position()
The other Sprite follows the Camera2D's get_target_position() for comparison
The Camera2D being followed is rotated by delta in _process

one_cam.tscn is from the perspective of the rotating camera.
two_cams..tscn is from the perspective of a second, zoomed out camera.

ReproProject.zip

@awardell
Copy link
Contributor Author

Just realized this is a duplicate of #44358

I had searched issues but didn't come across it at the time. Apologies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants