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

Wrong position in SubViewport (Object Picking) for scaled viewport #64893

Closed
MrJustreborn opened this issue Aug 25, 2022 · 1 comment
Closed

Comments

@MrJustreborn
Copy link

Godot version

v4.0.alpha.custom_build [cfcdd57]

System information

Manjaro

Issue description

If the subviewport is scaled, the input picking does not reflect the position on the screen for the object

Steps to reproduce

var factor = 1.0;
func _on_button_pressed():
	if factor < 1.0:
		#get_tree().root.set_content_scale_factor(1.0);
		factor = 1.0
	else:
		#get_tree().root.set_content_scale_factor(2);
		factor = .75;
	
	$SubViewportContainer/SubViewport.size = get_viewport().size * factor;
	
	$Button.text = "Change scaling - cur: " + str(factor)
  • to scale the subviewport for a 3D-scene
  • on a StaticBody listen for the _on_static_body_3d_input_event
  • if the subviewport has a sacling-factor of 1 everything is fine
  • if the subviewport has a scaling-factor of 0.75 the mouse-cursor triggers the input_event NOT on the object but with an offset to the top left

Minimal reproduction project

testProject.zip

@Calinou
Copy link
Member

Calinou commented Aug 25, 2022

Duplicate of #34805 (same cause).

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