Touch delay


I am making a android game that needs a ball following my finger. However, there is some touch delay when i run the game on device.

I am using this code:

 Vector3 newPos =Camera.main.ScreenToWorldPoint(Input.mousePosition);
 touchCircle.transform.position = new Vector3(newPos.x,newPos.y,0) ;

Do you guys have any ideas that can improve the delay problem? Thanks !

well that’s the world of touch screens :slight_smile: you can try to forward predict the movement of the finger by calculating how fast it was depending on Time.deltaTime and where it then will be next frame.

I disagree that “this is the world of touchscreens” :p. There should not be any visible delay when an object follows your finger on screen, unless something else is going wrong. How is your frame rate? Can you include maybe the frame rate counter from the Standard Assets or use the Profiler to check? You should also copy a minimalist setup of your script and the needed “touchCircle” and test it in a new, otherwise empty project. Maybe something else is causing your device to run slowly. What about the hardware, is it maybe too old to even run a simple project? And most important: What exactly do you mean with “delay”? Does your object follow the finger and then slowly catches up to its position or does it always stay behind? You might just be seeing something else than what you intended to code. Just for starters: ScreenToWorldPoint usually expects the z-value to correspond to the distance between the world point you’re hitting and the camera, so your code might not be exactly what you want.