Search Unity

[RELEASED] Windows 7 multitouch

Discussion in 'Assets and Asset Store' started by Virtualware, Sep 27, 2012.

  1. Virtualware

    Virtualware

    Joined:
    Sep 17, 2012
    Posts:
    75
    We are proud to announce the release of our Windows 7 multitouch solution for Unity3D, now available in Asset Store (http://u3d.as/3p7).

    Finally you can use singletouch and multitouch screens directly in Unity3D. No more need to use TUIO or other external programs.

    Feature list:
    • Works with Windows 7.
    • Windows 8 coming soon.
    • Support one finger and multifinger touches.
    • Includes NGUI support for basic events.
    • Gestures to NGUI objects.

    See the included readme.txt for more information, or reply to this post with a question.

    Hope you enjoy this new multitouch capability.

    UPDATE 1.06:
    • Windows 8 supported
    • Lots of fixes and improvements.
     
    Last edited: Mar 25, 2013
  2. kasulogamestudio

    kasulogamestudio

    Joined:
    Mar 22, 2012
    Posts:
    130
    Looks nice, any video examples?
     
  3. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Cool! Might get it soon. Can we see a video in action?
     
  4. Bjerre

    Bjerre

    Joined:
    Nov 8, 2006
    Posts:
    108
    Hi, just bought your windows7 touch asset from the store and there seems to be a problem with some of the code.
    I'm getting the following errors:

    Assets/W7Touch/NGUI/UICameraW7Touch.cs(41,46): error CS0122: `UICamera.GetTouch(int)' is inaccessible due to its protection level

    Assets/W7Touch/NGUI/UICameraW7Touch.cs(54,54): error CS0122: `UICamera.Raycast(UnityEngine.Vector3, ref UnityEngine.RaycastHit)' is inaccessible due to its protection level

    Assets/W7Touch/NGUI/UICameraW7Touch.cs(62,37): error CS0122: `UICamera.RemoveTouch(int)' is inaccessible due to its protection level

    Assets/W7Touch/NGUI/UICameraW7Touch.cs(102,30): error CS0122: `UICamera.ProcessTouch(bool, bool)' is inaccessible due to its protection level
     
  5. Virtualware

    Virtualware

    Joined:
    Sep 17, 2012
    Posts:
    75
    You must apply the patch included in the W7Touch/NGUI folder. There are instructions in the included readme.txt.
     
  6. Bjerre

    Bjerre

    Joined:
    Nov 8, 2006
    Posts:
    108
    The readme file doesn't mention the ngui.patch.
     
  7. redfoxy

    redfoxy

    Joined:
    Sep 30, 2012
    Posts:
    3
    Hi,

    first of all, thank you for developing this! I just bought it, how do I apply the NGUI.patch, I get same errors like Bjerre... I'm using unity3.5.5f2 pro on mac and ngui.

    Maybe you could give me a little example how do I process touches from GetTouch, it would be very nice

    Thank you in advance.
     
    Last edited: Sep 30, 2012
  8. Virtualware

    Virtualware

    Joined:
    Sep 17, 2012
    Posts:
    75
    Sorry, I forgot to include some patching instructions. I'm updating the readme.txt with some instructions, and I put them here too. I'm also making a video tutorial to use it with NGUI.


    Patching is a very standard process, you can find several tools on the internet, o apply it manually.

    If you use some kind of version control, like TortoiseSVN, right clicking on the .patch file has a submenu to apply it. If it asks, use the suggested path.

    If you prefer to do it manually, the .patch file is just plain text, with lines to be removed marked with a minus sign, and lines to be added marked with a plus. Line numbers and the other lines are for context, so you can know where to replace.

    Or you can make the modifications yourself, by making the following methods public (add "public" to the beginning of the line): Raycast, GetTouch, RemoveTouch and ProcessTouch
    and adding this line
    Code (csharp):
    1. SendMessage("ProcessInput", null, SendMessageOptions.DontRequireReceiver);
    in the middle of the Update method, just before
    Code (csharp):
    1. if (useMouse  mHover != null)
    Maybe some day the NGUI author accept this patch and makes it available in the next update, making this process unnecesary.
     
  9. Virtualware

    Virtualware

    Joined:
    Sep 17, 2012
    Posts:
    75
    You can find an example of use in the UICameraW7Touch.cs file, in the ProcessInput method, which is used for the NGUI integration. Maybe is a little complex and has too many NGUI related code, but I hope it helps.
     
  10. Virtualware

    Virtualware

    Joined:
    Sep 17, 2012
    Posts:
    75
  11. redfoxy

    redfoxy

    Joined:
    Sep 30, 2012
    Posts:
    3
    thank you so much for the patch explanation and the video! I think now I can get started.
     
  12. H-Alex

    H-Alex

    Joined:
    Oct 2, 2012
    Posts:
    26
    Hi,

    Is you extension working without NGUI, with some functions just like the standard Input API ?

    Regards,
     
  13. Virtualware

    Virtualware

    Joined:
    Sep 17, 2012
    Posts:
    75
    There is an API to get the touches, so you can use it without NGUI. The W7TouchManager class has the API to access the touches, and you can use UICameraW7Touch as an example of how to process the touches.
     
  14. valyard

    valyard

    Unity Technologies

    Joined:
    Jun 4, 2010
    Posts:
    291
    Hi,

    That's great that someone is adding needed functionality for us multi-touch developers.
    But actual touch/gestures recognition is much more than just getting WM_TOUCH events. And it's wrong to say that TUIO is worse than win7 touch. There are cases when TUIO is a much better solution.

    I am a multi-touch feveloper myself. And here's (mostly) my open-source library which is much more than just touch recognition.
    https://github.com/InteractiveLab/TouchScript

    I believe that adding WM_TOUCH events is just a matter of time for Unity team because of Windows 8. If right now only a dozen of people need this functionality, with Windows 8 it will be a common request.
     
  15. Virtualware

    Virtualware

    Joined:
    Sep 17, 2012
    Posts:
    75
    Our package does more than getting WM_TOUCH events, thats where the NGUI integration comes into play. Single finger (press, release, click, double click) is handled to the NGUI event system and some two finger gestures are implemented also (scroll, rotate, and drag).
    We intentionally left the possibilty to read raw touches to integrate with other touch gestures libraries or custom solutions.

    By the way, our solution does work inside the editor and is stable. Replacing the WndProc is not the best solution, but if you want to know how we do it, you'll have to buy the package. ;)
     
  16. valyard

    valyard

    Unity Technologies

    Joined:
    Jun 4, 2010
    Posts:
    291
    I understand that. We just didn't need it at that time.
    If you want an integration with something like NGUI you can fork the lib and write it yourself. We don't use NGUI so we don't need it.
     
  17. bigdaddio

    bigdaddio

    Joined:
    May 18, 2009
    Posts:
    220
    OK this really is not good

    1: I go to run and I get this stupid NGUI thing, I do not have or want NGUI I am using Scaleform, I only want to deal with the touches responsively.
    2: It will not run: I get this error... Host has not Windows 7, it has: 'Microsoft Windows NT 6.1.7601.0' also, check if the screen is touch capable
    3: I do not have the touch screen as my developer envirionment, The touch screen is somewhere else, another floor in the building. I am going to then send it to a client. I am on a Windows 7 machine, but not with a touch screen.

    I really feel like you ripped me off of $50
     
  18. redfoxy

    redfoxy

    Joined:
    Sep 30, 2012
    Posts:
    3
    Hi Valyard,

    I tried out your library (sample project included) - look's very nice and all gestures running very smooth, the touch recognition is very fast - great work!

    My problem is, I'm not very advanced in programming and I'm programming in javascript/unity script not in c#. Can I use your library with unity script, if so can you please post a sample code? I would like to use the scale gesture, but I need to define min and max scale factor for scalable objects.

    Thank you in advance.
     
  19. bigdaddio

    bigdaddio

    Joined:
    May 18, 2009
    Posts:
    220
    valyard

    We should send you the $50 thanks man, your library saved asses this weekend. If anything good came from purchasing Win7 Multitouch its that I found your stuff.
     
  20. valyard

    valyard

    Unity Technologies

    Joined:
    Jun 4, 2010
    Posts:
    291
    First of all I didn't want to hijack the thread.
    There will be a post soon about the library and a package in the Asset Store.

    I need to test it. The library is for advanced users right now but we have plans to add easy to configure components.

    I'm glad you liked our effort. If you want you can promote the library to help it grow.
     
  21. Virtualware

    Virtualware

    Joined:
    Sep 17, 2012
    Posts:
    75
    If you don't want to use NGUI, just delete the NGUI folder, as is stated in the package description.


    Since the solution also works in the editor, it gives an error if no touch screen capability is detected. You can still use it in the editor, just ignore the error, but you won't be able to test the app in the editor without a touch screen. Maybe we should have put a warning, not an error, sorry.


    Anyway, it'll work in the published player if it has a touch screen, don't worry about that.


    I personally never tried it, but I think there is a refund option in the asset store, sending an email to assetstore@unity3d.com. We can't return your money directly as Unity keeps part of the money, but if you request to them, we'll give your money back.
     
  22. supershnee

    supershnee

    Joined:
    Oct 9, 2012
    Posts:
    2
    Hi VirtualWare,

    Nice asset. I have got it working fine in Windows 7 (without NGUI). Two questions for you though.

    (1) I need to get multitouch support in the Webplayer for my current project. Based on my research, it seems like the easiest way to go for this is to use a Windows to TUIO client to capture touches and an intermediary bridge to send the data to Unity via Javascript calls to the Web App. Any easier way to get multitouch support in the WebPlayer with your Asset that I haven't found?

    (2) You state that the asset supports Win7/Win8 touch and multitouch input in the asset store. I have tested the same scene (in the Editor) on Win7 and Win8 with a multitouch monitor. Win7 works perfectly. Windows 8 does not detect any touchpoints. Is there in fact Windows 8 multitouch support? If so, what would I need to do differently (I am just using the W7TouchManager script in my scene and calling its static methods on a LateUpdate)?

    Thanks
     
  23. Virtualware

    Virtualware

    Joined:
    Sep 17, 2012
    Posts:
    75
    DllImports doesn't work in webplayer, so our solution doesn't work. I don't know if you can make a desktop app that receives the touches and sends to the webplayer via sockets or similar, I never tried.

    My bad, I assumed the API will be compatible. I browsed the documentation and found that although the API and the messages still exists in Windows 8, people are getting odd results depending on the touch driver (touch mode should be enabled, instead of pointer mode).
    Until I can test and verify that it works, I'm going to remove the Win8 support from the package description. I'll start as soon as a I get a Windows 8 machine to develop the fix.
     
  24. UNITY3D_TEAM

    UNITY3D_TEAM

    Joined:
    Apr 23, 2012
    Posts:
    720
    thanks this is awesome
     
  25. maik

    maik

    Joined:
    Dec 4, 2011
    Posts:
    59
    So...will this work with windows 8? Does the app released can fit the requirements to the windows store?
     
  26. Virtualware

    Virtualware

    Joined:
    Sep 17, 2012
    Posts:
    75
    Not yet. As I wrote in a previous post, we need to make some changes to make it work correctly, otherwise is just a lottery. So I'll say no, we don't support Windows 8.
    I readed the requirements, and we'll try to make our solution compatible with the windows store when we add Windows 8 support.
     
  27. vivi90

    vivi90

    Joined:
    Jul 28, 2010
    Posts:
    78
    Virtualware,
    I sent you 1 possible windows 8 solution, please take a look. :)
    Regards, Valentin
     
    Last edited: Oct 31, 2012
  28. ranilian

    ranilian

    Joined:
    Dec 24, 2011
    Posts:
    45
    Hi,

    We have followed the readme file, however, now we get 2 instances of the "OnClick" event when we enable the W7TouchManager script; when it's disabled OnClick is sent once which is what should happen when you click with one finger.

    Can you fix this bug? We would like to still use the original NGUI functionality + multi-touch additions from this API.


    Thanks!
     
  29. Virtualware

    Virtualware

    Joined:
    Sep 17, 2012
    Posts:
    75
    Cool! Thanks!
    We are in holidays right now, but I'll give it a try on monday.
     
  30. Virtualware

    Virtualware

    Joined:
    Sep 17, 2012
    Posts:
    75
    Have you unchecked the mouse device in the UICamera script? since the first touch is interpreted as the mouse pointer in windows, you should disable mouse or you'll get double events.
     
  31. ranilian

    ranilian

    Joined:
    Dec 24, 2011
    Posts:
    45
    Okay so we unchecked the use mouse boolean. It works fine. However, we noticed that there are cases when the same ID of a touch is found in W7TouchManager.GetTouch(id).

    Here's a test case:

    Code (csharp):
    1. // Update is called once per frame
    2.     void Update ()
    3.     {
    4.         UILabel label = GetComponent<UILabel> ();
    5.         int touchCount = W7TouchManager.GetTouchCount ();
    6.        
    7.         string extra = "";
    8.         bool found = false;
    9.         for (int i = 0; i<touchCount; i++) {
    10.             W7Touch touch = W7TouchManager.GetTouch (i);   
    11.             extra += " :ID: " + touch.Id + "," + touch.Phase;
    12.             found = true;
    13.         }
    14.        
    15.         if(found)
    16.             Debug.Log(touchCount + extra);
    17.         label.text = touchCount + extra;
    18.     }
    And if you quickly just tap on the monitor. We get the following:
    Code (csharp):
    1.  
    2. 2 :ID: 100,Began : ID: 100,Moved
    3. 2 :ID: 100,Stationary :ID: 100,Ended
    4.  
    So as you can see, it thinks that that touch is 2 touches.
     
  32. Virtualware

    Virtualware

    Joined:
    Sep 17, 2012
    Posts:
    75
    Since the Touch events are sent by windows in the message loop, they are out of sync with the Unity loop, so what you are seeing it's not two touches with the same ID, but two events for the same touch ID.
    So yes, it's normal to receive more than one event per frame. I could have queued the events so they don't overlap, but I prefer it this way, because no delay is introduced.
     
  33. JoeProgram

    JoeProgram

    Joined:
    Aug 24, 2012
    Posts:
    5
    Hello!

    Do you know if your solution will work on the PixelSense? (http://www.microsoft.com/en-us/pixelsense/default.aspx)

    We've currently got a TUIO Bridge running for it but it adds a significant response delay, and I'm looking for something that will respond faster.

    Thanks!

    Joe
     
  34. Virtualware

    Virtualware

    Joined:
    Sep 17, 2012
    Posts:
    75
    We haven't tried any PixelSense screen, but according to this link it seems to use regular windows 7 touches.
    The other advanced info, like objects recognition, is provided throught a SDK so additional development would be required.
     
  35. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    I was not aware of this package. Sounds useful! I'll make those functions public in the next release.

    P.S. If there are other specific alterations or changes you need, just toss me an email (as I don't have your patch).
     
  36. Virtualware

    Virtualware

    Joined:
    Sep 17, 2012
    Posts:
    75
    Thanks! That'll make our lives so much easy :)
     
  37. Flix

    Flix

    Joined:
    Aug 21, 2012
    Posts:
    4
    Hi guys,

    Is there any news regarding your plugin for Unity 4 and Windows 8 yet?
     
  38. Virtualware

    Virtualware

    Joined:
    Sep 17, 2012
    Posts:
    75
    We have a working Windows 8 version, but it's slowish, so we are working to improve it.
    Regarding to Unity 4, I didn't tried but it should work.
     
  39. Mr.Luo

    Mr.Luo

    Joined:
    Jan 16, 2013
    Posts:
    1
    Hi, can you tell me how can you get the input event for touch device?
     
  40. Virtualware

    Virtualware

    Joined:
    Sep 17, 2012
    Posts:
    75
    The W7TouchManager has static methods GetTouch and GetTouchCount to retrieve the touches. You should use this methods to process the touches.
    There are more instructions in the readme.txt.
     
  41. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    I purchased this the other day, and I would like to thank you for writing it in a form that I found very easy to hack around with. Specifically I have it working with Windows 8 :)

    It is a little slow with Windows 8 in the editor, and it misses some touch events too, but its still good enough for some in-editor testing and I find the situation improves somewhat if I drag the game window out of the main Unity editor window. And most importantly it does not seem to have these problems in the built version of my apps. Having said that, the testing I've done so far is quite limited, but it seems promising.

    I used the info in that article someone at Intel wrote about Unity multitouch in order to change your code to be Windows 8 compatible. I assume this is the same thing as you have tried, but if you do need more info feel free to send me a PM.

    Now its time to do something fun with it :) For reference I am using the Acer T232HL monitor to give me multitouch in Win 8.
     
  42. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    I should also mention that I've never used multi-touch in Windows 7 so I have no way to compare windows 7 behaviour with how I have it working in Windows 8.
     
  43. Virtualware

    Virtualware

    Joined:
    Sep 17, 2012
    Posts:
    75
    I'm glad you liked our package :)
    We also have a Windows 8 code, but didn't have time to test it properly. Also, I'm planning to do some responsiveness improvements, so stay tuned ;)

    Regarding the editor issues, it's a known problem since we cannot establish the editor window size, so we have to interpret full screen touches as if they were scaled down to the editor window, and it's pretty weird to try to click things guessing where the touch would be :confused:
     
  44. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    OK thanks. I was actually having problems unrelated to the editor window size stuff, but they mostly seem to have gone away as I've been using the plugin in more ways, not sure why.

    By the way I think you need to look at the most recent version of NGUI - things that need to be public now are, but GetTouch and RemoveTouch are now static which causes other errors in your script.
     
  45. Virtualware

    Virtualware

    Joined:
    Sep 17, 2012
    Posts:
    75
    NGUI developer was very kind making those methods public :)
    It's on my ToDo list :)
     
  46. Sarudan

    Sarudan

    Joined:
    May 21, 2011
    Posts:
    65
    Hi

    I'm having an issue where touches appear to be getting released prematurely, and I'm not sure why. I have a Dell ST2220T multi-touch monitor.

    After following all the steps outlined, and testing out some buttons and draggable textures, I am at a loss.

    A simple way to reproduce this is to create a simple NGUI button. If you press and hold on the button, then drag your finger away from the button and let go, the button remains depressed. If you perform the same action with a mouse however, the button releases - no matter how far the mouse pointer has been moved away from the button.

    If I create a draggable texture and start dragging it around, it will just get released intermittently also, even though my finger has been in constant contact with the screen.

    In other applications (Windows 7 Desktop etc.), dragging windows around is seamless and they never get "dropped" until I release my finger from the screen.
     
  47. Virtualware

    Virtualware

    Joined:
    Sep 17, 2012
    Posts:
    75
    If I understand it correctly, your problem is that while dragging you must keep your finger within the object boundaries to keep dragging. If you drag your finger outside the object it gets released, its that correct?
    While I work on the fix, a temporary solution could be to scale up the object collider to cover the entire screen or similar, and scale down on release. I've used this solution in other projects with success, so tell me if it works for you, while I look for a more permanent fix.
     
  48. Sarudan

    Sarudan

    Joined:
    May 21, 2011
    Posts:
    65
    Hi

    That does appear to be the issue. If I stretch the collider out, the texture drags around reliably.

    Also, I could make the buttons activate on a press, but I prefer to have buttons activate on release so that users can drag their finger off the button if they decide not to press it after all.

    Thank you for the quick reply, and I hope you can get a fix out soon.
     
  49. joyceanblue

    joyceanblue

    Joined:
    Jul 26, 2010
    Posts:
    43
    hi, great work to make life easy for those who develop touch apps for pc (dont know why unity keeps on ignoring us). one question, have you tested it with fatalfrog's finger gestures?
     
  50. Virtualware

    Virtualware

    Joined:
    Sep 17, 2012
    Posts:
    75
    I'm glad you liked it :)

    No, sorry, and I don't think it'll work, because our touch system is independent from Unity's, so it has to be explicitly supported. May be you can contact with fatalfrog to ask them to support our touch system, and I'll be willing to help them in the process :)