Author Topic: ios Touch.pressure  (Read 2734 times)

slipstream

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
ios Touch.pressure
« 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..

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: ios Touch.pressure
« Reply #1 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. }