swipepad for google glass

Hello Developers!

I have got my hands on google glass and am trying to use the touchpad in my unity3d project but only swipe down works (with KeyCode.Escape). Does anyone know how to get swipe forward and backward working in unity?

Any help is much appreciated.

Thanks in advance!

Jainam

I’ve been trying to figure out the same thing for awhile and sorta found an answer. It’s a modified version of the examples in here http://forum.unity3d.com/threads/48601-Swipe-help-please

using UnityEngine;

using System.Collections;

public class SwipeDetector : MonoBehaviour {
public float comfortZoneVerticalSwipe = 500; // the vertical swipe will have to be inside a 50 pixels horizontal boundary
public float comfortZoneHorizontalSwipe = 500; // the horizontal swipe will have to be inside a 50 pixels vertical boundary
public float minSwipeDistance = 100; // the swipe distance will have to be longer than this for it to be considered a swipe

//the following 4 variables are used in some cases that I don’t want my character to be allowed to move on the board (it’s a board game)

public float startTime;
public Vector2 startPos;
public float maxSwipeTime;

void Update(){

		if (AndroidInput.touchCountSecondary == 1) {

			Touch touch = AndroidInput.GetSecondaryTouch(0);
					switch (touch.phase) { //following are 2 cases

					case TouchPhase.Began: //here begins the 1st case

						startPos = touch.position;
						//startPosGlass =	AndroidInput.GetSecondaryTouch(0).position;
						startTime = Time.time;

						break; //here ends the 1st case
						
					case TouchPhase.Ended: //here begins the 2nd case
						
						float swipeTime = Time.time - startTime;
						float swipeDist = (touch.position - startPos).magnitude;

						if ((Mathf.Abs(touch.position.y - startPos.y))<comfortZoneHorizontalSwipe && (swipeTime < maxSwipeTime) && 
							    (swipeDist > minSwipeDistance) && Mathf.Sign(touch.position.x - startPos.x)<0)
						{
							print("backSwipe");	
						}
						
				if ((Mathf.Abs(touch.position.y - startPos.y))<comfortZoneHorizontalSwipe && (swipeTime < maxSwipeTime) && 
							    (swipeDist > minSwipeDistance) && Mathf.Sign(touch.position.x - startPos.x)>0)
						{
							print("forwardswipe");
						}

				if (swipeDist < 50)
					{
							print("tap");
					}
						break; //here ends the 2nd case
			}
		}


	}
}