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

Viewport Scaling breaks local input (mouse position) #60925

Closed
michael-nischt opened this issue May 10, 2022 · 1 comment
Closed

Viewport Scaling breaks local input (mouse position) #60925

michael-nischt opened this issue May 10, 2022 · 1 comment

Comments

@michael-nischt
Copy link

michael-nischt commented May 10, 2022

Godot version

v3.4.4.stable.official [419e713]

System information

Arch Linux, NVIDIA GeForce RTX™ 3080 Laptop GPU, GLES3

Issue description

The viewport.get_mouse_position() isn't in local space if its inside a ViewportCotainer with stretch enabled.

The prevents the 3D Viewport Scaling demo's approach from being actually useful with mouse inputs.

Further, I believe there's an issue with the ViewportCotainer disabling the child Viewports "handle inputs locally" property setting when the project is (re-loaded). Aftewards you can enable it but to no effect. It stays enabled in the UI (even play/stop) but the coordinates are still global. Every project reload sets it back to false though. Which is super confusing as the issue only gets noticed on reloading the whole project (or maybe scene?).

UPDATE: If in the the project settings the test width & height are different than the actual width & height it further distorts the mouse position.

Steps to reproduce

Run the minimal project, press SPACE until resolution is set to 25%. Then left click close in the center of the window with the mouse and see that lowres viewports mouse position is reported in the resolution of the root viewort.

print("%s / %s | %s" % [get_viewport().get_mouse_position(), get_viewport().size, get_viewport().get_path()])

E.g.:

(528, 316) / (256, 150) | /root/HUD/ViewportContainer/Viewport

Minimal reproduction project

vpscale.zip

It's the 3D Viewport Scaling demo with a minimal script attached to the Cubes.tscn root object:

extends Spatial

func _process(delta):
	if Input.is_action_just_released("action"):
		print("%s / %s | %s" % [get_viewport().get_mouse_position(), get_viewport().size, get_viewport().get_path()])
@Calinou
Copy link
Member

Calinou commented May 10, 2022

Duplicate of #34805.

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