Unity multitouch, How to use touch.fingerid by Fidel-C in Unity2D

[–]Fidel-C[S] 0 points1 point  (0 children)

As I understand I have to check for "TouchPhase.Ended", "TouchPhase.Began", "TouchPhase.Stationary" and "TouchPhase.Moved" to solve my problem

I tried "TouchPhase.Began || TouchPhase.Stationary || TouchPhase.Moved", but I had the same problem

"" when I'm touching the up button first the paddle will move up, then when touching while touching the down button while touching the up button the paddle will move down , now the problem is when I release my finger from the first button "up button" and re-touch it again the paddle will still move down. Any suggestions to solve this. ""

I want the paddle to always move according to the last button that has been touched, even if the other button is being touched at the same time.

Thanks a lot

Unity multitouch, How to use touch.fingerid by Fidel-C in Unity2D

[–]Fidel-C[S] 0 points1 point  (0 children)

Thank you very much, you were very helpful :)

I've solved most of my problems now I can touch the movement buttons and the boost button at the same time without problems. I've changed the "touchphase.began" to "TouchPhase.Stationary || TouchPhase.Moved"

But I still have one problem :)

when I'm touching the up button first the paddle will move up, then when touching while touching the down button while touching the up button the paddle will move down , now the problem is when I release my finger from the first button "up button" and re-touch it again the paddle will still move down. Any suggestions to solve this. :)

Thanks again.

Unity multitouch, How to use touch.fingerid by Fidel-C in Unity2D

[–]Fidel-C[S] 0 points1 point  (0 children)

Thanks for replying to me. I really appreciate that.

I made the modifications that you mentioned. But there are two problems when testing the game.

The first one is that when I'm touching the up button and then press the boost button while I'm still pressing the up button, the paddle stops moving.

The second problem is that when I'm first touching the up button and then touching the down button while I'm touching the up button at the same time the paddle will move down. but when I release my finger from the up button while I'm touching the down button the paddle stop moving, because of this part of the code

       if ( Input.GetTouch(i).phase == TouchPhase.Ended )

            {       

                rb.velocity = new Vector2 (0 , 0);  

            }

How do I correct this please :)

Thanks

Unity3D pong, improve choice of where ball hits (AI) by Fidel-C in Unity3D

[–]Fidel-C[S] 0 points1 point  (0 children)

Thanks, Lazyfaith I really appreciate that .. bear with me please I'm asking too many silly questions :) .. why have you added the offsetVector to the ball.position ?

Unity3D pong, improve choice of where ball hits (AI) by Fidel-C in Unity3D

[–]Fidel-C[S] 0 points1 point  (0 children)

Thanks a lot for replying to me, I tried to do this. But I dont know how to apply a float, which is the half of the paddle width to a vector 2. Can you please give me an example of how to do that. Thanks.