Search Unity

[RELEASED] Easy Touch

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

  1. fumangy

    fumangy

    Joined:
    Mar 28, 2013
    Posts:
    17
    Thank you EasyTouch is the best
     
  2. concave

    concave

    Joined:
    Aug 28, 2012
    Posts:
    49
    hey easy touch team! nice work, i bought your package for swipe and pinch gestures. Now a few questions came up concerning the best way to combine EasyTouchEvents with the nGUI EventSystem and general best practises.

    Q 0: What is enable NGUI compatibility exactly doing?

    Q 1: I have only one big area listening to drag n drop events [OneFingerGestures] by nGUI. What i wanna do is to pinchZoom the Camera (pinchScale the AreaObject) [TwoFingerGesture] with the EasyTouch implementation on the same Area. Is there a out of the box solution (NGUI compability)
    for this problem.

    Q 2: What do you think is the best way / best practise to work with EasyTouches on multilayered Applications/UI's. What constructs doe's
    EasyTouch provide?

    greets,
    con
     
    Last edited: Jun 8, 2013
  3. Hedgehog-Team

    Hedgehog-Team

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

    Q0 : The NGUI compatibility allows you to not receive events when the user touch a NGUI panel

    Q1 : It will be very difficult if you enable NGUI Compatibility

    Q2 : Can you detail your question ?
     
  4. Shizapp

    Shizapp

    Joined:
    Jul 9, 2012
    Posts:
    15
    Hey Hedgehog Team

    First of all, AMAZING plugin you have made. It is very easy to use and I have been able to create pretty much any type of controls I need.

    However, I am having one issue. Right now I have the xAxis of a joystick influencing a rigid body not a character control and I have the joystick control the movement. I want to dynamically switch the character I am controlling and changing the receiverGameObject to my new gameObject is working but when I try to reassign the xAxisCharacterController to another character that is Rigidbody it's not working. What public attribute can I add my gameObject to in order to change the "Joystick X to" setting?
     
  5. Supershandy

    Supershandy

    Joined:
    Jul 18, 2012
    Posts:
    25
    Does anyone know of any tutorials for EasyTouch buttons? There seems to be plenty for joystick toturials which I have got working well, however I cannot get the buttons to work using either easytouch system or the NGUI compatability.

    I've tried calling my Fire() function in the On_ButtonDown method caller from the inspector and also tried calling it in code but it doesn't work, also tried enabling NGUI comptibility and adding the NGUI camera but that doesn't work either, however if I change the input to the space bar, it works.....
     
  6. Hedgehog-Team

    Hedgehog-Team

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

    Supershandy

    Joined:
    Jul 18, 2012
    Posts:
    25
    I've already watched that video but it didn't help too much, I can convert from C# to Javascript quite easily but as I said, the documentation is a bit, shall I say, sparse?

    It mentions NGUI compatibility but there doesn't seem to be anything more than just the mention of it and that easytouch doesn't call events when an Ngui panel is touched, but what are the Cameras and layers all about? I added the ngui camera and the default layer that it uses however NGUI doesn't respond to anything even though it should, It can detect when the mouse pointer is hovering over the ngui button.

    The easytouch button though, what is the "Method caller" on the event message sender in the inspector, I tried calling Fire() as Fire, but nothing happened, I set the game object as the same object that the joystick uses which has the shooting script attached to it.

    I'm not sure if i'm missing something basic as the joystick was really easy to set up.

    Oh and I don't have skype either sorry
     
  8. Hedgehog-Team

    Hedgehog-Team

    Joined:
    Feb 27, 2011
    Posts:
    1,155
    Can you send me your example ?
     
  9. Supershandy

    Supershandy

    Joined:
    Jul 18, 2012
    Posts:
    25
    I can't send an example as i'm at work but i can whittle down my code from memory to just show the parts that include easytouch.

    //various variables used in shoot code such as weapons etc

    var fireButton : EasyButton;

    function Awake()

    {
    fireButton = Gameobject.Find(FireButton).GetCompnent(EasyButton);
    }

    function OnEnable()

    {
    fireButton.On_ButtonDown += On_ButtonDown;
    }

    function On_ButtonDown(buttonName : String)

    {
    if(buttonName == FireButton)
    {
    //bunch of if statements to check if a weapon is selected, last time fired etc etc...
    //leads to calling Fire() function if an if statement is true
    //so if "if (gunselected == 0) (timelastfired => Time.time) { Fire() }
    }
    }

    function Fire()

    {
    //handles instantion of projectiles
    }

    now the code returns no errors and the button changes texture when clicked so it detects toich input, that much is clear, but it doesn't fire any projectiles.
     
  10. Hedgehog-Team

    Hedgehog-Team

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

    If you already have your own fire method, you have just to set in the inspector the name of methode.
     
  11. Supershandy

    Supershandy

    Joined:
    Jul 18, 2012
    Posts:
    25
    Do i still need to do the OnEnable function and On_ButtonDown function?

    Also i added Fire to the inspector variable but it did noting even though I set the gameobject as the target for messages whih the shoot script is attached to. Does it have to be named "Fire" or "Fire()" or do i have to attach the script to another object so that the script is the only one attached and then send th messages to its gameobect holder?
     
  12. Hedgehog-Team

    Hedgehog-Team

    Joined:
    Feb 27, 2011
    Posts:
    1,155
    When you set braodcast message, you must set the gameobject that will received and have a script with this method. You have just write "fire".

    And you can remove all code that you add , just keep function fire()
     
  13. Supershandy

    Supershandy

    Joined:
    Jul 18, 2012
    Posts:
    25
    So let me get this straight, can the gameobject have say two or three scripts attached to it with different names and the method caller will call the fire method from the script it finds it in or do i need to point the broadcast towards the specific script attached to the object?
     
  14. Shizapp

    Shizapp

    Joined:
    Jul 9, 2012
    Posts:
    15
    So.... Glad you are able to help Supershandy. Do you have any idea why I'm able to use a regular gameObject on Joystick X To instead of a Character Control but I can't assign a GameObject to it without getting the error that it needs to be a character control? I'm trying to reassign my joystick to a different character when one dies. I'm happy to show you what i mean via skype or any other method.
     
  15. cpasjuste

    cpasjuste

    Joined:
    Apr 2, 2012
    Posts:
    154
    Hi !

    I wonder if it's possible to cancel a gesture, like "gesture.Cancel()" or "gesture.phase == Phase.End".

    For example, i want to be able to use swipe everywhere on the screen, except if the swipe was started from the (easy) joystick position. The "gesture.isHoverReservedArea" is almost that, but if i move out of the area then the swipe will be active, which is not what i want.

    For now we can do something like this, but it would be more convenient to just be able to cancel a gesture :
    Code (csharp):
    1.  
    2. bool[] cancelSwipe = new bool[10];
    3. private void On_SwipeStart( Gesture gesture )
    4. {
    5.     cancelSwipe[gesture.fingerIndex] = gesture.isHoverReservedArea;
    6. }
    7.    
    8. private void On_Swipe( Gesture gesture )
    9. {
    10.     if( !cancelSwipe[gesture.fingerIndex] )
    11.         {
    12.  
    13.         }
    14. }
    15.  
    Thanks,
    David.
     
    Last edited: Jun 19, 2013
  16. concave

    concave

    Joined:
    Aug 28, 2012
    Posts:
    49

    @ Q2:

    a detailed problem:

    i need a swipe gesture recognition only at a specific GO.
     
  17. vicour

    vicour

    Joined:
    Feb 29, 2012
    Posts:
    13
    Simple question: (hopefully)

    First off, been very happy with easy touch so far.

    I used the photograph example scene "ManipulationImage" to modify my camera for a strafing effect when the user drags their fingers in the scene. (makes their camera move) The problem is, the camera moves in the direction of the drag, I want the camera to move in the opposite direction from where they drag. (like navigating a web page) Its not completely obvious how to do this.

    How can I reverse the direction a user drags? (user drags right, camera goes left, etc)
     
  18. vicour

    vicour

    Joined:
    Feb 29, 2012
    Posts:
    13
    error: double post
     
  19. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    I found Easy Touch generating garbage, this is profiler on mobile

    $ey.jpg

    Seems to be here, string +=. Should be using a stringbuilder, or try to avoid string generation.

    $easytouch.jpg
     
  20. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462
    I have a scene with only one object that has a collider.

    When I drag the mouse in the empty space around the object, I do not get any OnDrag or Dragging Event. Is dragging only being fired when it has a collider?
     
  21. profanicus

    profanicus

    Joined:
    Nov 23, 2009
    Posts:
    295
    I believe so; you will get OnSwipe events when dragging in empty space.
     
  22. dhatch6

    dhatch6

    Joined:
    Jun 20, 2013
    Posts:
    1
    Just bought EasyTouch and i'm liking it a lot so far. However, after applying a joystick to my character, there's some sort of gesture that's rotating my camera. It's 3rd person and the camera is always supposed to face the same direction and follow the character along.

    I'm currently using the 3rd Person Camera provided by unity with my own joystick player controller. I also have a button in the bottom right corner. When I'm moving my character around with the joystick, if I touch anywhere on the screen with another finger in an even remotely swipe gesture, it forces the camera to position behind the player. Is there something I need to disable in the EasyTouch options that I am missing?

    Edit: It also happens sometimes when I go to press the joystick by itself with no other finger.

    Edit2: I just made my own camera and it no longer happens so I guess it's not a problem anymore. However, I'm still kinda curious as to why it would have somehow linked gestures with the camera that wasn't doing anything with them if anybody has an answer
     
    Last edited: Jun 21, 2013
  23. Hedgehog-Team

    Hedgehog-Team

    Joined:
    Feb 27, 2011
    Posts:
    1,155
    hi all,

    Please, you can post your support on our forum (llok at my signature), it will be easier for me and you to follow your issue. Because right now I'm often traveling for several days, it becomes difficult to answer when there are several post while on our the forum, you can follow individual

    Thank you for your understanding.
     
  24. zeroiq50

    zeroiq50

    Joined:
    Jun 15, 2013
    Posts:
    15
    Hi guys,
    I have been waiting 7 days for a reply to a request for help that I posted on your forum. I had no choice but to abandon EasyTouch for that job but I would still like to know if I can incorporate it into my main project...
    What is the best way to get in touch with you? forum or email? and do you have any plans to expand on the literature and/or video tutorials?

    Cheers.
     
  25. Mikie

    Mikie

    Joined:
    Dec 27, 2011
    Posts:
    367
    I would like to use your forum, but I do not have an invoice no. to use. I did master card the purchase. Believe me.
     
  26. Hedgehog-Team

    Hedgehog-Team

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

    zeroiq50 : I give support on issue with EasyTouch, but I can't write code for you. You ask me some code for your game. EasyTouch requires minimal programming knowledge. Do you look at the different examples?

    Mikie : You don't receive order from unity ? In this case can you send me a screenshot of your AssetStore account with EasyTouch on it ?

    Nicolas
     
  27. Eyehawk

    Eyehawk

    Joined:
    Dec 24, 2012
    Posts:
    288
    Hi Hedgehog,
    I've been playing with EasyButton, and I'm trying to integrate it with the Realistic FPS Kit.

    One of the actions for picking up items is within another function - the code is as follows:

    "if Input.GetKey(use){
    //Code for using items here"

    I wanted to replace the input.GetKey with something like:
    EasyButton.On_ButtonPress.Equals("Pickup");

    However this doesn't seem to work, and I've not found much from the documentation to help.

    Note that I have set up the button to broadcast to the game object. If I put in the function On_ButtonPress() in it I can test that it receives the broadcast, but the code for picking up items is embedded within another function and whole bunch of other conditions.
     
  28. Hedgehog-Team

    Hedgehog-Team

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

    If you want to do that you must :

    * Create a public variable type og easybutton on your script
    * Drag and drop your button on the inspector
    * And test button state

    In this case, you don't need to setup broadcast.

    Code (csharp):
    1. public class NewBehaviourScript : MonoBehaviour {
    2.    
    3.    
    4.     public EasyButton myButton;
    5.    
    6.  
    7.     // Update is called once per frame
    8.     void Update () {
    9.    
    10.         if (myButton.buttonState == EasyButton.ButtonState.Down){
    11.             // Do action   
    12.         }
    13.     }
    14. }

    Please use our forum , if you have another issue.

    Nicolas
     
  29. tinoh

    tinoh

    Joined:
    Feb 21, 2013
    Posts:
    28
    Hi,

    I got a problem which I dont understand.

    - I got EasyTouch C# in scene
    - Camera is set (there is only 1). Auto-Select is enabled. Pickable Layers is Default (as is the sprite).
    - I got a toolkit2d sprite with a collider on and a script
    - In that script I got in Start() EasyTouch.On_SwipeStart += EasyTouch_On_SwipeStart;
    - That function is nothing more then this: Debug.Log("SwipeStart");

    Now if I touch anywhere OUTSIDE of the colliders I will get swipe messages. If I actually start to swipe on the collider nothing happens. What did I miss?
     
  30. Hedgehog-Team

    Hedgehog-Team

    Joined:
    Feb 27, 2011
    Posts:
    1,155
    You don't recevie swipe but a drag on an objet.

    Swipe is raise when you swipe in an empty area
    Drag is raising when you swipe on an auto select object

    Nicolas
     
  31. tinoh

    tinoh

    Joined:
    Feb 21, 2013
    Posts:
    28
    Wow that was fast. Kudos.
     
  32. Eyehawk

    Eyehawk

    Joined:
    Dec 24, 2012
    Posts:
    288
    Hi Nicolas,
    Thanks for your reply. I've registered on the forums, so I am just waiting for approval before I post there.

    I had a go of your solution, but I've probably missed something - I get the errors returned:
    "error CS0070: The event 'EasyButton.On_ButtonPress' can only appear on the left hand side of += or -= when used outside of the type EasyButton"

    It's probably that I haven't correctly used the following statement:
    if (EasyButton.Pm_ButtonPress.Equals("Pickup"))
    {
    ...
    }

    A bit more of the player RFPS script is as follows:

    if (pickUpBtnState Input.GetKey(use)){
    //run the PickUpItem function in the pickup object's script
    hit.collider.SendMessageUpwards("PickUpItem", SendMessageOptions.DontRequireReceiver);
    pickUpBtnState = false;
    }



     
  33. donghong61

    donghong61

    Joined:
    Dec 31, 2012
    Posts:
    55
    I own a easy touch and i really need to make a control for my game
    the joystick is gonna be similar to the one in the raywar ( a free game for android )
    I really need help
    Any demos ?
     
  34. wormx

    wormx

    Joined:
    Jun 11, 2013
    Posts:
    1
    I have a grid of tiles, and I want to touch one tile, and then drag across neighbouring tiles, with each tile receiving touch events. What I've found is that auto-select will only select the first tile upon touchStart or dragStart -- during the drag phase, it will not detect other objects. Is there a way to have an event triggered when a touch, drag, or swipe hits an object?
     
  35. Hedgehog-Team

    Hedgehog-Team

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

    eyeHawk, do you have a skype account ?

    Donhhomg61 : You can do every thing you want, with event or event directmode. A lot of people ask me to have a joystick similar to a specific game. But I can't create an example for each game . I'm going to look at your game to see if it's possible

    Wormx : You can use a static method that return to you if an object is under a specific touch. Look at the document because I'm not at home ...

    Please for better support can you register on our forum, it will be easier for you and me to follow your issue.

    Thak you

    Nicolas
     
  36. SethPDA

    SethPDA

    Joined:
    Mar 23, 2012
    Posts:
    8
    I am developing a 2.5D platformer for PC and Android and I'm using the "Advanced 2.5 Platformer Kit" as base and I also use EasyTouch for the Android platform. I managed to make the jump button work on screen, but I would like to make 2 more buttons. One for running left, and one for running right, and I have no idea how to assign those buttons to run left/right. Can anybody help me with this?

    The way how I did it for jumping, is I added a EasyButton on screen, and then I specified the Jump method in the Inspector and assigned it to the Player. But how to assign to a button a method, which makes my player run to the right, based on these classes?

    PS.: I'm more an artistic guy, rather than programmer, but I understand code.

    Here is my PlatformerPhysics class(too long to post it here):

    http://pastebin.com/7hSJGPMb

    And here is my PlatformerController:

    http://pastebin.com/mxxrithR

    And last but not least, here is my EasyTouch EasyButton class:

    http://pastebin.com/cT9mYgn0

    Pleeeease help me, this is the LAST thing I need to figure out and I can release the game after testing :(
     
  37. Hedgehog-Team

    Hedgehog-Team

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

    Do the same thing :

    * Create two more button
    * Enable broadcast
    * Drag and drop your gameobject
    * Enable use specific method
    * Enter the name of you running left or right method

    $help.jpg

    Nicolas
     
  38. nonaxanon

    nonaxanon

    Joined:
    Jan 20, 2012
    Posts:
    44
    hi guys before i buy this nice handy tool, i want to ask, can you use this joystick to manage a 2d game, moving in x and y axes, and flipping in x and -x direction, no rotation , is this possible with this plugin ?
     
  39. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    Has this been tested on Windows 8 store apps?
    We have taken over a project that uses EasyTouch and none of the touch behaviour works on Windows 8 Store Apps build.
    The version we have in the project is v2.5 from Nov 2012.

    Thanks
     
  40. Goofy420

    Goofy420

    Joined:
    Apr 27, 2013
    Posts:
    248
    I've been looking for examples on include interaction, and all that is on the website and docs is this.

    Code (csharp):
    1. Interaction : Include
    2. In this mode, any message or live interaction is possible. You must enter yourself in our script
    3. to read the values of the following variables:
    4.  
    5. /// Gets the joystick axis value between -1  1...
    6. public Vector2 JoystickAxis {
    7. get {
    8. return this.joystickAxis;
    9. }
    10. }
    11. /// Gets the joystick value = joystic axis value * jostick speed * Time.deltaTime...
    12. public Vector2 JoystickValue {
    13. get {
    14. return this.joystickValue;
    15. }
    16. }
    17.  
    which doesn't help at all.

    How would I implement it into this:
    Code (csharp):
    1.  
    2. public void Handle (Transform target)
    3.     {
    4.         if (Input.GetKey (KeyCode.LeftAlt) || Input.GetKey (KeyCode.RightAlt) || Input.GetKey (KeyCode.AltGr)) {
    5.             Screen.lockCursor = false;
    6.             Screen.showCursor = true;  
    7.             return;
    8.         } else {
    9.             Screen.lockCursor = true;
    10.             Screen.showCursor = false;
    11.         }
    12.         if (axes == RotationAxes.MouseXAndY) {
    13.             rotationY += myJoystickR.JoystickAxis.y * sensitivityY;
    14.             rotationY = Mathf.Clamp (rotationY, minimumY, maximumY);
    15.            
    16.             target.localEulerAngles = new Vector3 (-rotationY, target.localEulerAngles.y, 0);
    17.             target.Rotate (0, Input.GetAxis ("MouseX") * sensitivityX, 0);
    18.            
    19.         } else if (axes == RotationAxes.MouseX) {
    20.             target.Rotate (0, Input.GetAxis ("MouseX") * sensitivityX, 0);
    21.         } else {
    22.             rotationY += Input.GetAxis ("MouseY") * sensitivityY;
    23.             rotationY = Mathf.Clamp (rotationY, minimumY, maximumY);
    24.            
    25.             mCamera.localEulerAngles = new Vector3 (-rotationY, mCamera.localEulerAngles.y, 0);
    26.         }
    27.     }
    28.  
     
  41. Hedgehog-Team

    Hedgehog-Team

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

    I'm in vacation and I can only read my mail. It´s possible that you wait my back in 5 days ?
     
  42. Goofy420

    Goofy420

    Joined:
    Apr 27, 2013
    Posts:
    248
    #
     
    Last edited: Aug 1, 2013
  43. benfattino

    benfattino

    Joined:
    Nov 26, 2010
    Posts:
    43
    I am using easy touch to move object and a GUI script for menu. Easy touch does not recognize that the GUI button is above everything and it always work. It is possible to exclude GUI button area from Easy touch?
     
  44. Hedgehog-Team

    Hedgehog-Team

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

    Benfattino : Yes you add a reserved area , and when you a touch a button the member IsHoverReservedArea of Gesture class will be equal to TRUE

    Goofy420 : It is possible that you post on our forum, it will be easier for me and you to follow your issue
     
  45. benfattino

    benfattino

    Joined:
    Nov 26, 2010
    Posts:
    43
    Ok. Thanks. I found "IsHoverReservedArea" on your example and it work. Nice plugin. Save me...
    Would be nice if the plugin found the areas where there is a gui automatically...
     
    Last edited: Aug 4, 2013
  46. DavidRDev

    DavidRDev

    Joined:
    Jul 19, 2012
    Posts:
    47
    Hello!

    We've enabled auto-pick layer and we've filtered certain layers in the Easy Touch Gameobject script, but it appears that the ray caster isn't actually masking that layer it just ignores the actual click. Is there a way to manipulate pickable layers from acting like a mask?


    Reason for this is because we have over extended building colliders in the way of the player when you tap on the screen and it's not masking that collision layer.


    Thanks for the help!
     
  47. Hedgehog-Team

    Hedgehog-Team

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

    I don't realy understand what you want, because EasyTouch uses LayerMask fonctionnality.

    public LayerMask pickableLayers; // Layer detectable by default

    Code (csharp):
    1. Ray ray = easyTouchCamera.ScreenPointToRay( screenPos );
    2.  
    3.             RaycastHit hit;
    4.            
    5.             LayerMask mask = pickableLayers;
    6.                
    7.             if( Physics.Raycast( ray, out hit,float.MaxValue,mask ) ){
    8.                 return hit.collider.gameObject;
    9.             }
    Can you send me an example ?
     
  48. DavidRDev

    DavidRDev

    Joined:
    Jul 19, 2012
    Posts:
    47
    Thanks! This helped out track down our bug! sorry for the post.
     
  49. camel82106

    camel82106

    Joined:
    Jul 2, 2013
    Posts:
    304
    Hi,
    I haven't yet found information about supported platforms of Easy Touch.

    I'm mainly curious about support of windows phone 8.

    Thanks
    Peter
     
  50. Hedgehog-Team

    Hedgehog-Team

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

    I don't have Window Phone 8, EasyTouch uses Unity API so if Unity doesn't support WP8 ....

    Nicolas