Issue detecting input position with Match3 engine and Orthographic camera

I’ve been trying Defold for a few days and making a small game using the Match3 engine (emthree) and Orthographic camera API from @britzl (sorry for the ping but maybe you can help me :))

The issue is that the input position doesn’t match with what you see on screen, the only place the input is detected is on the bottom left corner of the screen

Here’s a small video where you can see my mouse and I’m trying to move the pieces but it doesn’t work

I tried changing a lot of things, going back to the default camera, and even copying emthree so I could edit the Lua files but I just can’t seem to find what the issue really is or what exactly I’m missing

also I’m using the same script from the brick example from emthree, added the Orthographic camera and it doesn’t detect the input correctly

Without seeing your code, I have to guess that you’re trying to directly use action.x and action.y from on_input(). That won’t work since those coordinates are in screen space but game objects are positioned in world space. The quickest way to fix that would be to use Orthographic’s camera.screen_to_world() to convert the coordinates, but for a simple fullscreen game like this it might be better to rewrite it using a GUI instead of game objects to make input and scaling to different window sizes a bit easier.

1 Like

Correct. Convert the coordinates you get in on_input() to world space coordinates using screen_to_world() before you use them in the game.

1 Like

Thank you! this solved it

1 Like