- Home /
converting mouse to touch control
Am I missing anything in the equation
converting my mouse control script:
void Update () { batPos.y = minY + Input.mousePosition.y / Res * deltaY; gameObject.transform.position = batPos;
in Pong.
To touch control:
void Update () { // we find the height we have to go up from minY batPos.y = minY + Touch.tapCount > 0 / Res * deltaY; gameObject.transform.position = batPos;
Really new at this any help and/or tutorials would be helpful.
Is your gameObject in world space? If so, you'll need to convert to the screen mouse to world space like this.
Vector3 world$$anonymous$$ousePos = Camera.current.ScreenToWorldPoint(Input.mousePosition);
Answer by LukeDraper · Feb 18, 2019 at 12:50 PM
Its in local space. The mouse control drags the panel (In PONG) vertically just fine when using the mouse cursor, I just want to make it do the same when dragged by a finger touch on mobile. Apologies if it was a vague question.
Sorry if its a dumb question.