How to have both swipe and tap functions in 3DUI?

Because I tried to use scrollbox to achieve a sliding effect, I couldn’t simulate clicking with left and right buttons at the same time in VR, and scrollbox couldn’t be used.

To have both swipe and tap functions in a 3DUI, you can use a combination of gesture recognition and button interactions.

  1. Gesture Recognition: You can use gesture recognition techniques to detect swipe gestures. A swipe gesture typically involves the user moving their finger or a pointing device in a specific direction and then releasing it. You can use the gesture recognition API provided by the input system to detect swipe gestures.
  2. Button Interactions: You can also use button interactions to detect tap events. A tap event typically involves the user clicking or touching a button or a specific area on the screen. You can use the button widget provided by the UI system to create interactive buttons.

Here are the steps to create a 3DUI with both swipe and tap functions:

  1. Create a gesture recognizer: Create a gesture recognizer that listens for swipe gestures. You can use the input system’s gesture recognizer API to create a custom gesture recognizer.
  2. Create a button widget: Create a button widget that listens for tap events. You can use the UI system’s button widget to create a custom button widget.
  3. Bind the gesture recognizer to the button widget: Bind the gesture recognizer to the button widget to detect both swipe and tap events. You can do this by creating a binding between the gesture recognizer and the button widget.
  4. Implement the swipe and tap event handlers: Implement event handlers for the swipe and tap events. When a swipe or tap event is detected, the corresponding event handler will be called. You can use these event handlers to update the state of your game or trigger other actions.

By combining gesture recognition and button interactions, you can create a rich 3DUI that supports both swipe and tap functions.

1 Like