Search Unity

Discussion Making a touch panel for mobile FPS with the new input system

Discussion in 'Input System' started by ahmedpro1112, Apr 4, 2023.

  1. ahmedpro1112

    ahmedpro1112

    Joined:
    Nov 16, 2022
    Posts:
    4
    Problem:
    The issue is I need to the pointer to move if the touch was only initiated in the right half of the screen & also not touching a button, as indicated in the video below:

     

    Attached Files:

  2. ahmedpro1112

    ahmedpro1112

    Joined:
    Nov 16, 2022
    Posts:
    4
    Problem:
    The issue is I need to the pointer to move if the touch was only initiated in the right half of the screen & also not touching a button, as indicated in the video below:



    My approaches to the solution:

    1. Make event system only accept input when the first touch was made inside a touch panel
    Code (CSharp):
    1. //This is not real code
    2. if ( !(Touch was initiated inTouch panel) || (Touch is in contact with UI)
    3. {
    4.     Eventsystem.pointer.speed = 0;
    5. }
    6. else {
    7.     EventSystem.Pointer.speed = (Original value)
    8. }


    2. Make event system deny input in a dead zone touch panel (What i was trying to do in video clip) and accept
    Code (CSharp):
    1. //This is not real code
    2. if (Touch was initiated in dead zone)
    3. {
    4.     Eventsystem.pointer.speed = 0;
    5. }
    6. else {
    7.     EventSystem.Pointer.speed = (Original value)
    8. }


    What I tried:
    1. Toggling
    Raycast Target 
    for the touch panel (See screenshot)
    2. Emulate different input methods
    If somebody can could enlighten me one correct way to accomplish my goal, then I will be more than grateful.[/MEDIA]