New answers tagged

0

Neither of the proposed solutions are entirely correct (or at the very least, are misleading), since instead of keeping track of the actual finger/pointer id, they are only regarding that move event's index within the MotionEvent object, which may vary depending on the number of fingers on the screen. For example: if the user presses the screen with one ...


1

Try multiplying your offset by your aspect ratio: Screen.width / Screen.height. if (Input.touchCount > 0) { var t = Input.GetTouch(0); var delta = t.deltaPosition; if (delta != Vector2.zero) { var offset = transform.position; offset.x += delta.x * Sensitivity * ((float) Screen.width / Screen.height) * Time.deltaTime; ...


0

You are using Mathf.Clamp to prevent it from going out of bounds. You can use it as well to restrict the speed offset.x += Mathf.Clamp(delta.x * Sensitivity, -_MaxSpeed, _MaxSpeed) * Time.deltaTime; _MaxSpeed is something you would need to figure out until it matches your gameplay.


Top 50 recent answers are included