Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: ronronmx on September 22, 2012, 01:45:28 AM

Title: Detect swipe velocity and start/end
Post by: ronronmx on September 22, 2012, 01:45:28 AM
Hi guys, i'm new here, and also a new user of NGUI, and I have a few questions...

I have a DetectInput() class which checks for thumb slides. I get the start Vector2 of the slide when calling 'TouchPhase.Began', and then check for the position of the slide in 'TouchPhase.Moved', and if 'slideEnd - slideStart > 200' I then do something.

Does NGUI have a built-in way to check for TouchPhases? I can get the position of the swipe by using 'OnDrag(Vector2 delta)', but how can I check for the delta position when the swipe starts, for example in 'OnPress(bool isPressed)' since it doesn't have a Vector2 parameter?

I don't want to start mixing my touch detection code with NGUI's, so if I can do everything the same with NGUI then I'd rather do that.

Thanks for your time!
Stephane
Title: Re: Detect swipe velocity and start/end
Post by: ArenMook on September 22, 2012, 11:27:25 AM
UICamera.currentTouch.pos tells you the current position of the touch action inside an NGUI event callback such as OnDrag. UICamera.currentTouch.totalDelta tells you the delta since OnPress(true).
Title: Re: Detect swipe velocity and start/end
Post by: ronronmx on September 25, 2012, 01:05:57 PM
UICamera.currentTouch.pos tells you the current position of the touch action inside an NGUI event callback such as OnDrag. UICamera.currentTouch.totalDelta tells you the delta since OnPress(true).

Got it, thanks!