Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: slipstream on October 26, 2016, 03:07:48 AM

Title: ios Touch.pressure
Post by: slipstream on October 26, 2016, 03:07:48 AM
Hello,

Is that possible in NGUi to return the pressure of a touch?

Right now i have a button with a NGUI UIEventTrigger and OnPress Event.
How can i get the pressed touch pressure?

Thanks a lot, i struggle to find out..
Title: Re: ios Touch.pressure
Post by: ArenMook on October 30, 2016, 12:09:04 PM
Check UICamera.ProcessTouches function.
  1. int count = (UICamera.GetInputTouchCount == null) ? Input.touchCount : UICamera.GetInputTouchCount();
  2.  
  3. for (int i = 0; i < count; ++i)
  4. {
  5.     var touch = (UICamera.GetInputTouch == null) ? Input.GetTouch(i) : UICamera.GetInputTouch(i); // <-- actual Unity touch
  6.     // do whatever you want with it
  7.     var nguiTouch = UICamera.GetTouch(touch.fingerId); // <-- this gives you the corresponding NGUI touch
  8. }