Touchpad - Swipe

Swipe Up/ Down/ Left/ Right

In order to enable the below APIs, you must add JMRInteraction Script to a GameObject in your scene.

Returns true during the frame the user performs swipe using the trackpad. You need to call this function from the Update function since the state gets reset for each frame. It will not return true until the user releases this key and swipes the trackpad again.

Swipe Up

bool JMRInteraction.GetSwipeUp(out float val);

Returns true if swiped up, also returns swipe up value.

using UnityEngine;
using UnityEngine.UI;
using JMRSDK.InputModule;
using JMRSDK;
 
public class JMRDemoInteractionExample : MonoBehaviour
{
     public void Update()
     {
          bool isSwipeUp=JMRInteraction.GetSwipeUp(out float val);
     }
}

Swipe Down

bool JMRInteraction.GetSwipeDown();

Returns true if swiped down, also returns swipe down value.

using UnityEngine;
using UnityEngine.UI;
using JMRSDK.InputModule;
using JMRSDK;
 
public class JMRDemoInteractionExample : MonoBehaviour
{
     public void Update()
     {
          bool isSwipeDown=JMRInteraction.GetSwipeDown(out float val);
     }
}

Swipe Left

bool JMRInteraction.GetSwipeLeft();

Returns true if swiped left, also returns swipe left value.

using UnityEngine;
using UnityEngine.UI;
using JMRSDK.InputModule;
using JMRSDK;
 
public class JMRDemoInteractionExample : MonoBehaviour
{
     public void Update()
     {
          bool isSwipeLeft=JMRInteraction.GetSwipeLeft(out float val);
     }
}

Swipe Right

bool JMRInteraction.GetSwipeRight();

Returns true if swiped right, also returns swipe right value.

using UnityEngine;
using UnityEngine.UI;
using JMRSDK.InputModule;
using JMRSDK;
 
public class JMRDemoInteractionExample : MonoBehaviour
{
     public void Update()
     {
          bool isSwipeRight=JMRInteraction.GetSwipeRight(out float val);
     }
}

Last updated