Search Unity

[RELEASED] Easy Touch

Discussion in 'Assets and Asset Store' started by Hedgehog-Team, May 8, 2012.

  1. Hedgehog-Team

    Hedgehog-Team

    Joined:
    Feb 27, 2011
    Posts:
    1,155
    Hi,

    There are no right or wrong solutions.I would add a little script that controls the size in the LateUpdate.

    Something like this :
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class SizeController : MonoBehaviour {
    5.  
    6.     public Vector3 minSize;
    7.     public Vector3 maxSize;
    8.  
    9.     void LateUpdate () {
    10.  
    11.         Vector3 localSize = transform.localScale;
    12.  
    13.         localSize.x = localSize.x<minSize.x?minSize.x:localSize.x;
    14.         localSize.y = localSize.y<minSize.y?minSize.y:localSize.y;
    15.         localSize.z = localSize.z<minSize.z?minSize.z:localSize.z;
    16.  
    17.         localSize.x = localSize.x>maxSize.x?maxSize.x:localSize.x;
    18.         localSize.y = localSize.y>maxSize.y?maxSize.y:localSize.y;
    19.         localSize.z = localSize.z>maxSize.z?maxSize.z:localSize.z;
    20.    
    21.         transform.localScale = localSize;
    22.     }
    23. }
    24.  
     
    Kellyrayj likes this.
  2. Kellyrayj

    Kellyrayj

    Joined:
    Aug 29, 2011
    Posts:
    936
    Thanks Nicolas,

    I'm close. I'm now going for a tweening solution to scale up to the minSize if the local scale is less than my minimum scale. However, I can't seem to figure out how to trigger my method from the quick action. Right now I am calling it from the OnPinchAction event thing, but this prevents me from ever scaling past that minimum size.

    How do I add an event for OnPinchEnd?

    Thanks!
     
  3. Hedgehog-Team

    Hedgehog-Team

    Joined:
    Feb 27, 2011
    Posts:
    1,155
    Hi

    I can't seem to figure out how to trigger my method from the quick actionI
    You have just to call it from event part

    upload_2016-2-27_12-16-48.png


     
  4. Hedgehog-Team

    Hedgehog-Team

    Joined:
    Feb 27, 2011
    Posts:
    1,155
    Hi

    EasyTouch 5.0.6 is available on store (update from your account)

    EasyTouch 5.0.6
    ===============
    * Fixe multi-touch on some specific platform (some platform as Window 10 don't support multi-touch on Editor, but only in build)
     
    BTStone likes this.
  5. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    Installed EasyTouch 5.0.6 on 5.2.3f1 with force asset text serialization and I get a ton of these log errors when installing: "Binary to YAML conversion: type unsigned int is unsupported"

    And then the demo scenes are messed up and look like this:
    upload_2016-3-4_14-36-24.png

    How do you suggest I progress from here?
     

    Attached Files:

  6. Hedgehog-Team

    Hedgehog-Team

    Joined:
    Feb 27, 2011
    Posts:
    1,155
  7. docsavage

    docsavage

    Joined:
    Jun 20, 2014
    Posts:
    1,021
    @UnLogick,

    The link that Hedgehog team posted doesn't work for me so in case it's not working for you I fixed it by going to Edit>Project Settings>Editor and changing Asset Serialization to mixed before importing EasyTouch.:)

    doc
     
  8. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    Thanks for the swift reply, good to know help is at hand.

    Switching to mixed serialization for the import worked, however this is only an option because this isn't a release project, changing serialization back and forth can take real time on a project near release. You really should look at the root problem and make your components stick to int rather than unsigned int.
     
  9. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    Yes, setting mixed worked for import, but no one in their right mind would use mixed asset serialization on a project with many developers.
     
  10. Hedgehog-Team

    Hedgehog-Team

    Joined:
    Feb 27, 2011
    Posts:
    1,155
    Hi,

    As I saided that doesn't come from EasyTouch, but a general Unity issue. I don't use unsigned int and scene from the screenshot comes from was made with Unity 5.2.0.

    The few posts talking about the problem does not solve compared to the script, but to do this operation when the creation of the project.
     
    docsavage likes this.
  11. Hedgehog-Team

    Hedgehog-Team

    Joined:
    Feb 27, 2011
    Posts:
    1,155
    Hi again,

    If you want to use EasyTouch in a project with 'Force Text" serialization.
    1- Create empty projet with classical "Mixed" mode
    2- Import EasyTouch
    3- Change mode to Froce Text
    3- Export EasyTouch package
    4- Import the new package in your Force Text projet

    The only "Generic"solution for you that I publish in this mode ,but I don't know all impact on classical user that use Unity Default mode (Force Mixes)

    http://answers.unity3d.com/questions/222281/asset-serialization-mixed-vs-force-text.html
    It is once again stated that it breaks the prefab
     
    Last edited: Mar 4, 2016
    docsavage likes this.
  12. docsavage

    docsavage

    Joined:
    Jun 20, 2014
    Posts:
    1,021
    hi @Hedgehog Team,

    Really liking Easytouch.

    Not sure if a bug or me doing something wrong. I have a dpad in the scene and the keyboard is my default for testing.

    Using,

    input = new Vector3(ETCInput.GetAxis("Horizontal"), ETCInput.GetAxis("Vertical"));

    And

    if (input.x == -1 || Input.GetKeyDown(KeyCode.A))
    {
    playerDirection = MovementDirection.Left;
    idle = false;
    running = true;
    Move();
    }


    The player was showing a vast acceleration so after a debug.log It shows that the input is called about 9 times on one keypress but in theory with it being a getkeydown it should only return true once per frame. When I change to the standard, input = new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"));
    it goes back to normal returning true once per frame.

    Any ideas??

    Thanks

    doc

    Edit - using 5.3.3p2 and windows 10

    Edit 2 - suspecting something else. If I hold down the key it is still moving. The getkeydown is acting more like autofire which according to unity scripting reference is not what it should do. According to scripting reference it is acting like getkey instead.

    Edit 3 - Have just created a new scene with a cube at 0,0,0 and made a simple script and get the same problem sort of.

    input = new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"));
    //input = new Vector3(ETCInput.GetAxis("Horizontal"), ETCInput.GetAxis("Vertical"));
    if (input.x == -1 || Input.GetKeyDown(KeyCode.A))
    {
    transform.position = new Vector3(transform.position.x -1,transform.position.y, transform.position.z);
    }

    if (input.x == +1 || Input.GetKeyDown(KeyCode.D))
    {
    transform.position = new Vector3(transform.position.x + 1, transform.position.y, transform.position.z);
    }

    etc.....


    But if remove all the input.x, input.y etc and leave just Input.GetKeyDown(KeyCode.S) it works as expected.

    If comment out the unity standard input and use yours, input = new Vector3(ETCInput.GetAxis("Horizontal"), ETCInput.GetAxis("Vertical"));

    it works for keyboard.

    Don't know whats going on? So easytouch fixes it for the keyboard. The dpad is still acting like autofire.

    Edit 5 - If the dpad is active in the scene the keyboard goes back to not working as expected. If dpad is inactive it starts to work again.
     
    Last edited: Mar 7, 2016
  13. Hedgehog-Team

    Hedgehog-Team

    Joined:
    Feb 27, 2011
    Posts:
    1,155
    Hi,

    Let's start with some information. All virtual control can be simulated by key or joystick without to add your own code. You juste have to select the unity axe (Input Manager) (This simulation is enable by default)
    upload_2016-3-7_12-3-28.png

    Edit 2 - suspecting something else. If I hold down the key it is still moving. The getkeydown is acting more like autofire which according to unity scripting reference is not what it should do. According to scripting reference it is acting like getkey instead.
    But as you add your own key test with the key "A", and as by defautl horizontal axe from EasyTouch Control use horizontal axis from Unity (Edit => Project settings => Input), and Horizontal axis from Unity use key A :

    so Input.GetKeyDown(KeyCode.A) => false
    but ETCInput.GetAxis("Horizontal") = TRUE (because it's using the simulation with horizontal axis from unity)

    This is why when you holddonw the key it is still moving


    As you can see Unity Horizontal axe use key "a" as alternative key for horizontal, so you averride this value with your own code
    upload_2016-3-7_12-11-1.png

    => You don't have to add your own code tu simulate the control, juste setup the Unity axes that you want toi use
     
  14. docsavage

    docsavage

    Joined:
    Jun 20, 2014
    Posts:
    1,021
    @Hedgehog Team,

    Really appreciate the quick response. Thanks

    Sort of understand of what you are saying. So as my player doesn't need to have a key held down to keep moving I assume the way to get the dpad to act as a getkeydown would be to have the dpad use events and call a move function?
     
  15. Hedgehog-Team

    Hedgehog-Team

    Joined:
    Feb 27, 2011
    Posts:
    1,155
    Hi,

    No, you have ETCinput.GetAxisDownUp/ Right etc... look at APIDocumenation page 5 & DPad-Event-Input example scene
     
  16. docsavage

    docsavage

    Joined:
    Jun 20, 2014
    Posts:
    1,021
    Excellent. The product seems to have every option covered.

    Thanks again

    doc
     
  17. CoCoNutti

    CoCoNutti

    Joined:
    Nov 30, 2009
    Posts:
    513
    Hi Hedgehog.
    I'm wanting to use ES5 for tvOS - essentially, I want to see a pointer on screen that mimics a mouse - using the pad to move the pointer around screen then clicking on the pad to select an object.
    How can this be done using ES5?

    Thanks
     
  18. Hedgehog-Team

    Hedgehog-Team

    Joined:
    Feb 27, 2011
    Posts:
    1,155
    Hi,

    EasyTouch manages touch with Unity API class, so as Unity manages touch on touch pad of TV OS with this class, you have nothing to do, just create a touch managment with easytouch.

    For you need, I think you have to create a script that move your sprite or ui element when you will receive the event On_TouchDown , and move the sprite.ui element relative to deltaposition member of gesture class sent as parameter for each event. An clik cann be manage with Onn_SimpleTape for example
     
    Last edited: Mar 12, 2016
    CoCoNutti likes this.
  19. CoCoNutti

    CoCoNutti

    Joined:
    Nov 30, 2009
    Posts:
    513
    Thank you
     
  20. vutruc80

    vutruc80

    Joined:
    Jun 28, 2013
    Posts:
    57
    @Hedgehog Team, i have just brought EasyTouch and registered to Hedgehog Forum with account geod, email tructre80@yahoo.fr but got rejected. Could you have a reason for this rejection please?
     
  21. Hedgehog-Team

    Hedgehog-Team

    Joined:
    Feb 27, 2011
    Posts:
    1,155
    Hi,

    Have you properly registered your invoice number? (If so, I apologize for the inconvenience)

    I invite you to create a new account, be sure to identify your invoice number.
     
  22. vutruc80

    vutruc80

    Joined:
    Jun 28, 2013
    Posts:
    57
    @Hedgehog I did copy&paste my paypal invoice number but still got rejected. Could you recheck my case please? I'm out of email account for now.
     
  23. Hedgehog-Team

    Hedgehog-Team

    Joined:
    Feb 27, 2011
    Posts:
    1,155
    Hi,

    You need to create a new account, and the invoice number, it's the one send by Unity on PDF , it's starting by 3XXXXXX
     
  24. vutruc80

    vutruc80

    Joined:
    Jun 28, 2013
    Posts:
    57
    Thank you, i can login the forum finally.
     
  25. sjm-tech

    sjm-tech

    Joined:
    Sep 23, 2010
    Posts:
    734
    Hi Nicolas,
    I would like to use Easy Touch Controls on a Standalone Windows 10 hardware with a multi touch(4 touches) monitor. (table kiosk) but i found some problem on multitouch detection. I'm using two virtual joysticks (moving and freelook ) but i cant use the two joystics together... do you have any suggestion?
    Cheers
    Max
     
  26. Hedgehog-Team

    Hedgehog-Team

    Joined:
    Feb 27, 2011
    Posts:
    1,155
    Hi,

    The touch is managed directly by Unity for EasyTouch Control (joystick, touchpad etc...).

    Have you tri to add a Touch Input Module on your Event System GameObject ?
    Which version of Unity do you use ?
     
  27. sjm-tech

    sjm-tech

    Joined:
    Sep 23, 2010
    Posts:
    734
    Thanks Nicolas for pointing out the "Touch Input Module" ... it is precisely the opposite. On Standalone Windows 10 build you need to remove "Touch Input Module" and add "Standalone Input Module" .
    Now all work very well.
    Cheers
    Max
    P.s. Unity 5.3.4
     
  28. chaneya

    chaneya

    Joined:
    Jan 12, 2010
    Posts:
    416
    Nicolas,

    This will be my third game using EasyTouch so thanks for such a great Asset. :)

    I'm working on a Top Down RPG style game and for the first time using Unity's NavMeshAgent. I'm having trouble figuring out how to get EasyTouch to return a vector3 that I can use with NavMeshAgent.SetDestination(Vector3) for my navigation target in 3d world space. My code works fine but that's because I'm ONLY using EasyTouch to register a touch event so I know when a user has touched the screen and then I use ScreenPointToRay(UnityEngine.Input.mousePosition) and Physics.Raycast to provide my RayCastHitInfo for my 3D world touch position. I feel like I'm duplicating things because I have read that EasyTouch also uses ScreenPointToRay so I assume gesture has the vector3 I need but for the life of me I can't figure out how to get that vector3. I've used gesture.position, gesture.StartPosiiton, gesture.pickedObject.transform.postion, gesture.GetTouchToWorldPoint()

    This code works but I would really appreciate if you could look at this small section of code and tell me if there is a better way to do it.
    Do I really need a RayCast in addition to EasyTouch?
    Do I need to be using ScreenPointToRay and If so what do I put in place of UnityEngine.Input.mousePosition?
    Thanks

    Code (CSharp):
    1. void On_TouchStart( Gesture gesture)
    2.     {
    3.         if (gesture.pickedObject != null)
    4.         {  
    5.             Ray ray = Camera.main.ScreenPointToRay(UnityEngine.Input.mousePosition);
    6.             int pickedObjLayer = gesture.pickedObject.layer;
    7.             Vector3 pickedObjPos = gesture.pickedObject.transform.position;
    8.  
    9.             if (Physics.Raycast(ray, out touchHit, 100))
    10.             {                                                                      
    11.                 if (pickedObjLayer == 11) //11 = Ground Layer
    12.                     playerNavMeshAgent.enabled = true;
    13.  
    14.                 if (!playerIsClimbing)
    15.                     playerNavMeshAgent.SetDestination(touchHit.point);
    16.             }
    17.         }
    18.     }
    Allan
     
  29. Hedgehog-Team

    Hedgehog-Team

    Joined:
    Feb 27, 2011
    Posts:
    1,155
    Hi,

    Your script is generally correct, you need to do ScreenPointToRay for the exact location.

    You have to replace Input.mouse by gesture.position, that all....
     
  30. chaneya

    chaneya

    Joined:
    Jan 12, 2010
    Posts:
    416
    Thanks.

    I guess what confused me is gesture.position is a vector2 but Input.mouse is a vector3. All I had to do was manually set gesture.position z to 0 in a new Vector3.

    Code (CSharp):
    1. Ray ray = Camera.main.ScreenPointToRay(new Vector3(gesture.position.x, gesture.position.y, 0f));
    It's too bad EasyTouch does not have Physics Raycast built in so gesture could output the RayCastHitinfo and be used to get the exact 3D world position thus setting a navigation destination. I think that would expand the usability of the product.

    Allan
     
  31. Hedgehog-Team

    Hedgehog-Team

    Joined:
    Feb 27, 2011
    Posts:
    1,155
    Hi,

    You don't have to create your own vector3 from geture.position, you can write this without error
    Camera.main.ScreenPointToRay(gesture.position);

    EasyTouch already done a raycast but only to find pickable object relative to specific layermask that you have setup, but for you want to do may be it requieres a new layermask , we must not forget that EasyTouch must also be very fast, add raycasts who used only a few times is not necessarily a good thing (not to mention whatever it multiply the raycasts for each finger).

    There is a difference between 3D world position & the result from a ScreenPointToRay, the both are 3D world, but the first depends on Z (gesture class has some methods), and the second of a RayCast but not really need each time.

    May be I can expand gesture to support what you want, but you will need to pass all the necessary parameters, distance, layermask out structure, so in the end is what really gain?
     
  32. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    Hi @Hedgehog Team,

    I got a little issue about EasyTouch Control, I want to use it for multiplayer game, but when 2 or more players entering the game, all of them share the same ETC, it's possible to have multiple ETC's for each player ?

    Thanks in advance!
     
  33. Hedgehog-Team

    Hedgehog-Team

    Joined:
    Feb 27, 2011
    Posts:
    1,155
    Hi,

    So it's a multiplayer game, but I you share control & ETCInput between all your player. This part must must be on client side only ...

    You must tell me more about your game, real multi plyer, multi player on the same device ...
     
  34. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    It's a real multiplayer for Android, I'm using from your examples the FirstPersonController+Jump-Simple for player control, attached on my player prefab.

    In the game session I get this error:
    Code (CSharp):
    1. ETCInput control : Joystick already exists
    2. UnityEngine.Debug:LogWarning(Object)
    3. ETCInput:RegisterControl(ETCBase) (at Assets/_ASSETURI_STORE/EasyTouchBundle/EasyTouchControls/Plugins/ETCInput.cs:48)
    4. ETCBase:Awake() (at Assets/_ASSETURI_STORE/EasyTouchBundle/EasyTouchControls/Plugins/ETCBase.cs:165)
    5. ETCJoystick:Awake() (at Assets/_ASSETURI_STORE/EasyTouchBundle/EasyTouchControls/Plugins/ETCJoystick.cs:165)
    6. UnityEngine.Networking.NetworkIdentity:UNetStaticUpdate()
     
    Last edited: Jun 1, 2016
  35. Hedgehog-Team

    Hedgehog-Team

    Joined:
    Feb 27, 2011
    Posts:
    1,155
    Ok, it is the normal.
    But I do not understand your problem, if you are in multi-player, player management with the controls is a client part. You do not need to exchange it with other players, but just the position...

    Player A (ETCInput + joystick ) <= position + shoot + live etc .... => Player B (ETCInput + joystick)

    The controller is in some way the user interface, you should not exchange this information with other players.
     
  36. Hedgehog-Team

    Hedgehog-Team

    Joined:
    Feb 27, 2011
    Posts:
    1,155
    The debug tell you that you have many controls with the name Joystick.

    Do you instantiate the same prefab when a new player joins the session ?
     
  37. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
  38. Hedgehog-Team

    Hedgehog-Team

    Joined:
    Feb 27, 2011
    Posts:
    1,155
    I don't know how you synchronize other players, but you need to create another prefab without control (joystick etc...) for player who join the session.
     
  39. Hanghyeon

    Hanghyeon

    Joined:
    Jun 28, 2016
    Posts:
    1
    i want to know the methods solving speed. i want to show any chart
    ex)

     
  40. ccgbagnet

    ccgbagnet

    Joined:
    Oct 3, 2013
    Posts:
    6
    Dear Hedgehog Team, wonderful plugin! However, I was wondering if it's possible to detect a Swipe and Hold gesture? I need so to make my character move continuously on the swipe direction while the player hasn't lifted the finger.
    I think I may have done so by subscribing to swipe_start. Inside my swipe start method, I called a coroutine that moves the player until the player lifts his finger. However, SwipeStart(gesture) doesn't seem to detect any directions. Here's an excerpt of what I did:


    Code (CSharp):
    1.  
    2. void On_SwipeStart (Gesture gesture)
    3.     {
    4.         print(gesture.swipe.ToString());
    5.        
    6.         touching = true;
    7.         if (curGameState == GameStates.GAME)
    8.         {
    9.             switch (gesture.swipe)
    10.             {
    11.             case EasyTouch.SwipeDirection.DownLeft:
    12.             case EasyTouch.SwipeDirection.UpLeft:
    13.             case EasyTouch.SwipeDirection.Left:
    14.                 dir = FacingDirection.WEST;
    15.             //    QueueMove (FacingDirection.WEST);
    16.                 break;
     
  41. AVAN

    AVAN

    Joined:
    Jun 12, 2015
    Posts:
    3
    Hello, i want to ask something about the ETCInput, because the joystick and the touchpad runs ok, but i just load to another scene and the vector Horizontal doesn't exist, and with setcontrolactived and setcontrol neither, like i said it's everything ok until the load of the scene. I hope you can help me and answer the soon as you can.
     
  42. Hedgehog-Team

    Hedgehog-Team

    Joined:
    Feb 27, 2011
    Posts:
    1,155
  43. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    Hi Hedgehog Team,

    Did EasyTouch have feature or support of flipping the controls, e.g: Right to Left or vice versa?

    Thanks,
     
  44. Hedgehog-Team

    Hedgehog-Team

    Joined:
    Feb 27, 2011
    Posts:
    1,155
    Hi,

    Sorry for the delay, but there is a bug in this topic, that Unity team try to fixe.

    EasyTouch Controlsd uses Unity UI, so there are quick anchor setting with offset in each virtual controls inspector :
    upload_2016-8-10_11-53-51.png

    So you can change this setting by script. Some users use another way, by creating 2 virtuals control canvas (for right && left)
     
    RoyalCoder likes this.
  45. keenanwoodall

    keenanwoodall

    Joined:
    May 30, 2014
    Posts:
    598
    Hi. I'm using your package and need to detect swipes for panning a camera. I used EasyTouch on a previous project and didn't have any problems registering swipes. On my current project I added a method to On_Swipe. The method is never called. Am I missing something?
     
  46. Hedgehog-Team

    Hedgehog-Team

    Joined:
    Feb 27, 2011
    Posts:
    1,155
    Hi,

    I will need more informations :
    - Can you post your script
    - Do you have UI element on your scene ?


     
  47. keenanwoodall

    keenanwoodall

    Joined:
    May 30, 2014
    Posts:
    598
    How would I use EasyTouch to detect when the user has sliced an object by swiping over it? Right now all my objects are detecting a slice whenever I swipe anywhere on the screen.
     
  48. Alverik

    Alverik

    Joined:
    Apr 15, 2016
    Posts:
    417
    Hi, I just began my first multi platform project, I got interested in easy touch, and I was wondering... if I get easy touch can I use some of the gestures in PC too? or will I need to have separate blocks of code for mobile and PC?... Do the events only work on mobile? I want to keep the same functionality on both versions if possible (also I'm probably not going to use pinching).

    Anyway, any advice will be greatly appreciated. (by the way, strangely I'm having trouble posting... just letting you know in case there's duplicate posts.)
     
  49. Hedgehog-Team

    Hedgehog-Team

    Joined:
    Feb 27, 2011
    Posts:
    1,155
    Hi

    keenanwoodall
    You have to use the method GetCurrentPickedObject from gesture class, this method return the current object under the touch. So you have to test this result relative to your current gameobject.

    Or you can use the member pickedObject of gesture class with Auto update picked gameobject set to true in EasyTouch inspector.

    Alverik
    By default Easytouch uses simulation on window and Mac platform, so you have nothing to do, if you to use event them on PC & Mac
     
    Alverik likes this.
  50. Alverik

    Alverik

    Joined:
    Apr 15, 2016
    Posts:
    417
    Hey thanks for the answer! but weird... why is it only this thread? The site doesn't seem to accept the click when I hit like, no matter how many times I try...

    Edit: ...Never mind, now I see. Somehow, posting and hitting like doesn't work when you come from a link which contains the post number (i.e: page-31#post-2774266)... Still, that's the weirdest thing I've seen in the forums (after all, that link was from my alerts...)