Godot: Touchscreen buttons shapes are not centered respect to the texture

Created on 5 May 2020  路  2Comments  路  Source: godotengine/godot

Godot version: 3.2.1

OS/device including version: Windows 10

Issue description: Touchscreen buttons shapes are not centered respect to their texture even if the option "Shape centered" is checked. It seems that the shape is shifted on the right bottom side of the texture.

Steps to reproduce:

  • Add a touchscreen button node to the scene
  • Add "normal" and "pressed" textures to it
  • Check the option "Shape centered"
  • Add a circle shape with a radius that makes the shape bigger then the texture
  • Run the scene and tap/click on the extreme left side of the texture

Minimal reproduction project:
TouchButtonsTest.zip

bug junior job gui

Most helpful comment

Fixed by e253451a5b (cherry-picked from #38542).

All 2 comments

Could confirm with the attached MRP.

The problem comes because the (correct) transform used for drawing:
https://github.com/godotengine/godot/blob/1c23a0cc7f879774f56404378db1bf86979e42d1/scene/2d/touch_screen_button.cpp#L140-L142

Is not the same one as the one used when checking if the point is inside the shape:
https://github.com/godotengine/godot/blob/1c23a0cc7f879774f56404378db1bf86979e42d1/scene/2d/touch_screen_button.cpp#L265-L266

Specifically, notice the lack of texture->get_size() in the second snippet.

Fixed by e253451a5b (cherry-picked from #38542).

Was this page helpful?
0 / 5 - 0 ratings