The touch screen shift in rare case (SOLVED)

I had met a strange behavior in the game. The touch screen is shif down a lot on the y coordinator.
Environment:
The vendor of the android phone is xiaomi


The applicationis bundled via editor 1.2.146 on windows
image

It’s hard to reproduce with certain steps. I only can provide a video of the screen to prove that.

The exit button is clicked totally outside of the button area.

1 Like

How do you check for touch-to-node interactions? Do you use gui.pick_node? What arguments are you passing along to it? action.x and action.y?

2 Likes

Hi sven,

The game uses gooey as the GUI system. The touch-to-node interaction is processed in the core part.
> local over = gui.pick_node(component.node, action.x, action.y)

This is really a rare case. It works well most of the time on android phone. Here are some more information for the background:

  1. In daily development, the game is started from the editor on windows and the whole team have never meet this issue till now. We use gooey as the gui system for more than half a year.
  2. Recently the project is close to a milestone and we start to test it on device with about 50 internal users. This issue is reported the first time on last week.

Are you using builtin GUI material?

Are you using a camera solution or custom render script?

Yes, we have a custom render script based on the Rendercam from the asset portal.
https://www.defold.com/community/projects/84064/

I can share the custom scripts. The game also has 3D models, so camera is also added in certain worlds(via load different collection proxy. The screen video is captured in a pure 2D world.)
render.zip (3.6 KB)

You’re rendering the gui with a different projection from the standard projection. This will affect how gui nodes are rendered and this will impact gui.pick_node() (unless you adjust mouse coordinates).

render.set_viewport(0, 0, rendercam.window.x, rendercam.window.y)
render.set_view(vmath.matrix4())
render.set_projection(self.gui_proj) -- gui_proj only calculated on update_window
render.disable_state(render.STATE_CULL_FACE)

What if you change to:

render.set_projection(vmath.matrix4_orthographic(0, render.get_window_width(), 0, render.get_window_height(), -1, 1))
2 Likes

Thanks.
The change is already made and till now i hadn’t met this issue again.
It’s hard to reproduce even with the origin code, so we will pay attention to this issue for a certain period.

2 Likes