- Home /
Touch.position, Touch.deltaPosition, Screen.width, Screen.Height
From a very famous Unity plugin source code, there is a line a don't quite understand:
var touchZero = Input.GetTouch(0);
var touchZeroPrevPos = touchZero.position - new Vector2(touchZero.deltaPosition.x / Screen.width, touchZero.deltaPosition.y / Screen.height);
what is purpose of touchZero.deltaPosition.x / Screen.width
? Could Touch.position
and Touch.deltaPosition
have the same unit (pixel) ? Why not just touchZero.position - touchZero.deltaPosition
?
Comment
Answer by Cuttlas-U · Apr 16, 2017 at 07:57 PM
hi; thats because the width change over diffecrent resloutions and platforms and u have to get the right thouch input from it;
Your answer
Follow this Question
Related Questions
Input.GetTouch(0) doesn't work 2 Answers
Input Touch.position 'inverted' relative to screen? 1 Answer
ScreenToWorldPoint fixed height 1 Answer