Bad screen_dx values in Android

I use screen_dx and screen_dy values to move camera in my game.
In desktop all working ok.
But in android first dx and dy values is very big. Looks like it screen_x and screen_y values

function on_input(self,action_id,action)
	if action_id == HASHES.INPUT_TOUCH then
		print("dx:" .. action.screen_dx)
		print("dy:" .. action.screen_dy)
	end	
end

In desktop:

DEBUG:SCRIPT: dx:0
DEBUG:SCRIPT: dy:0
DEBUG:SCRIPT: dx:0
DEBUG:SCRIPT: dy:0
DEBUG:SCRIPT: dx:4
DEBUG:SCRIPT: dy:-5
DEBUG:SCRIPT: dx:17
DEBUG:SCRIPT: dy:-23

In Android:

DEBUG:SCRIPT: dx:1065
DEBUG:SCRIPT: dy:-1793
DEBUG:SCRIPT: dx:0
DEBUG:SCRIPT: dy:0
DEBUG:SCRIPT: dx:-2
DEBUG:SCRIPT: dy:2
DEBUG:SCRIPT: dx:-2

Hmm, this sure looks incorrect. I’ll take a look on Monday.

2 Likes

The OSX version behaves the same way (print action.screen_dx outside your if conditional to see this). Since the behaviour is consistent on all platforms I wouldn’t consider this a bug but rather the expected behaviour and something that is easy to work around if you expected the first dx, dy to be 0.

1 Like

In windows, I don’t get such big values. So it is not consistent. And what about HTML? Yes workaround is simple, but it looks like a bug)

In windows, linux, html, i don’t get big value on first input.

1 Like

Sounds like a bug, hm. Do you still get large initial values if you use the multi touch binding instead of mouse?

1 Like

I get the expected behaviour in HTML5 as well. On Android we simulate a mouse for single touch which means that the screen_dx, screen_dy between two consecutive pressed/released sequences will have a delta value as if the mouse was immediately moved from the first released to the second pressed position.

You’re not doing multi-touch right?

1 Like

I use only one finger. The big values I get only for first action(where pressed equals true)

I will try, not near PC today. My workaround ignore action if action.pressed equals true