iisu Developer Forum

HomeHomeiisu™ 3.xiisu™ 3.xUnity 3D BridgeUnity 3D BridgeHow can I recognize the direction of Swipe Gesture?How can I recognize the direction of Swipe Gesture?
Previous
 
Next
New Post
2/21/2012 9:28 PM
 

Hi, I need to recognize the direction of SWIPE gesture to interact with a 3d menu. I read an old post of iisu 2.x talking about  "GESTURE_SWIPE_LEFT"  and "GESTURE_SWIPE_RIGHT".

Is there something in iisu 3.x? Or can I get event attribute to get direction?


Any help is appreciated. Thanks

 
New Post
2/22/2012 1:11 PM
 

The API 

change quite a bit : take a look at Developer Guide (in doc folder of  your iisu installation) at page 98.



 

 
New Post
2/22/2012 1:21 PM
 

Thanks a lot. It's just  I need ;)

 
New Post
2/22/2012 7:23 PM
 

I can't get the swipeType registering an event listener. 

Here's the code, but i can't read this parameter

//register swipe event
_iisuUnity.Device.EventManager.RegisterEventListener("UI.CONTROLLERS.GESTURES.SWIPE.Detected", new  OnSwipe(OnSwipeEvent));
 
private void OnSwipeEvent(string name)
{
}

 
New Post
2/24/2012 12:16 PM
 

I found this function:

//register an eventlistener that catches ALL events
_iisuUnity.Device.EventManager.RegisterEventListener("SYSTEM.Event", new Iisu.EventDelegates.System.Event(OnEvent));
 
private void OnEvent(string name, string eventName, object[] parameters)
{
    _events.Add(eventName);
}

Maybe i can get the required information from the object parameters, but how?

 
New Post
3/6/2012 11:31 AM
 

Please go to http://www.softkinetic.com/Support/Samples.aspx and download the samples pack iisu3csharp.Inside the package you will find the sample called 2D Controls NET which will show you how to use events and its data in C# code. This code in particular covers the event UI.CONTROLLERS.GESTURES.CIRCLE.Detected(int ControllerID, Vector3 pos, int direction).                                                                                                                                                                                                              

Hope it helps.

 
New Post
3/7/2012 8:19 PM
 

Thanks, I resolved converting into a string the 3th object of the function I wrote on the last post. It represents the direction of the swipe gestures (on page 98 of the developers guide there are all possible values)

 
New Post
3/11/2012 2:31 AM
 

Hi,

 I'm trying to achieve the same thing here and have resolved to catching all SYSTEM.Event event types when raised, but would much rather just assign the eventListener specifically to the UI.CONTROLLERS.GESTURES.SWIPE.Detected event.

 I searched for the 2D Controls NET example but it doesnt seem to be in the suggested download anymore?! Is what I've asked possible?

 Any help would be much appreciated.

 Cheers,

Theo

 
New Post
3/11/2012 11:36 AM
 

I tried to register only UI.CONTROLLERS.GESTURES.SWIPE.Detected event, but it seems that the delegate method doesn't have the parameters necessary to detect the direction.

Finally I used the OnEvent function:


01.private void OnEvent(string name, string eventName, object[] parameters)
02.{
03.    if (eventName.Equals("UI.CONTROLLERS.GESTURES.SWIPE.Detected"))
04.    {
05.        // Print SWIPE DIRECTION
06.        Debug.Log(parameters[3].ToString());   
07.    }
08.    else if(eventName.Equals("UI.CONTROLLERS.GESTURES.CLICK.Detected"))
09.    {
10.    }
11.    else if(eventName.Equals("UI.CONTROLLERS.GESTURES.CIRCLE.Detected"))
12.    {
13.    }
14.    else if(eventName.Equals("UI.CONTROLLERS.GESTURES.WAVE.Detected"))
15.    {
16.    }
17.}

 
New Post
3/13/2012 10:07 AM
 

Hi,

 

the pack of samples called iisu3csharp is still available at  http://www.softkinetic.com/Support/Samples.aspx . You can download it after login in.

As for the event itself. Every event in iisu carries a set of paramters related to this event. In case of SWIPE there are three values:

Name: UI.CONTROLLERS.GESTURES.SWIPE.Detected(int ControllerID, Vector3 pos, int swipeType) Description

Swipe detected in Controller number ControllerID at pos (in normalized coordinates).

swipeType indicates the swipe direction:

0: Up

1: Down

2: Left

3: Right

 

 

In the paramters array they are indexed started from 0. so the swipetype should be under the second element if you try to catch it via OnEvent. But you can also follow the example and use the delagate model.

 

BR,

_z

 
Previous
 
Next
HomeHomeiisu™ 3.xiisu™ 3.xUnity 3D BridgeUnity 3D BridgeHow can I recognize the direction of Swipe Gesture?How can I recognize the direction of Swipe Gesture?