Search code examples
spark-ar-studio

How to use Screen Tap to place 3d object on a plane in Spark AR Studio?


I want to use Screen Tap patch in Spark AR Studio to place an object somewhere on 3d plane created by Plane Tracker.

There is Move and Resize an Object in the World tutorial on the official site and it mentions Screen Tap in the intro section, but later it elaborates only on Screen Pan, Screen Pinch and Screen Rotate.

But I want user to tap to place. Is that possible?


Solution

  • Yes, there is an onTap gesture method available on the TouchGestures module see here: https://sparkar.facebook.com/ar-studio/learn/reference/classes/touchgesturesmodule/

    The code would be like this:

      TouchGestures.onTap().subscribe((gesture) => {
        planeTracker.trackPoint(gesture.location);
      });