Author Topic: Anyone Using NGUI and TouchScript successfully??  (Read 3592 times)

mplaczek

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 14
    • View Profile
Anyone Using NGUI and TouchScript successfully??
« on: February 05, 2014, 07:51:25 AM »
I'm currently working on a project that will not require any complex multitouch gestures... but I will need to support multiple users.
The application will need to run on a Window 7 multitouch monitor.

Thus far I have TouchScript's Touch debugger displaying the multi touch points as expected...
And of course, NGUI has been essential for building the GUI intensive application.

However... I can't get these two to play nicely together... the touches that fall over an NGUI widget work... however multitouch is a no go.

I've tried to incorporate the script here (https://github.com/InteractiveLab/TouchScript/issues/6) to automagically marry the two... however I'm getting errors:

Assets/TouchScriptNGUI.cs(52,59): error CS1502: The best overloaded method match for UICamera.Raycast(UnityEngine.Vector3, out UnityEngine.RaycastHit) has some invalid arguments
Assets/TouchScriptNGUI.cs(52,59): error CS1620: Argument #2 is missing out modifier

Multitouch is enabled on NGUI's UICamera...
Win7 touch input is attached to my TouchScript object...

Any suggestions would be greatly appreciated. I concede may have overlooked something really simple here.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Anyone Using NGUI and TouchScript successfully??
« Reply #1 on: February 05, 2014, 02:36:05 PM »
UICamera.Raycast has the following signature in NGUI:
  1. static public bool Raycast (Vector3 inPos, out RaycastHit hit)
The wrapper seems to expect this:
  1. static public GameObject Raycast (Vector3 inPos, ref RaycastHit hit)
I'm not sure which version of NGUI it was written for but it seems it needs to be updated from this:
  1. UICamera.hoveredObject = UICamera.Raycast(UICamera.currentTouch.pos, ref UICamera.lastHit) ? UICamera.lastHit.collider.gameObject : UICamera.fallThrough;
To this:
  1. UICamera.Raycast(UICamera.currentTouch.pos, out UICamera.lastHit);

mplaczek

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 14
    • View Profile
Re: Anyone Using NGUI and TouchScript successfully??
« Reply #2 on: February 05, 2014, 04:27:02 PM »
Thank you ArenMook,

Thank you for the fast reply,

and thank you for the solution.... It works!!