Patch Editor: Using the object tap patch

Use the Object Tap patch in Meta Spark Studio to make something happen in your effect when someone taps a specific object, like a plane or a mesh.

In this guide, we'll make an object get bigger when someone taps on it:

You could use other screen interaction patches to achieve similar effects, like Screen Tap or Screen Pan.

Creating an Object Tap patch

To create an Object Tap patch:

  1. Add an object to your scene. For this example, we'll use a plane object with a material and texture applied to it.
  2. Select the object in the Scene Panel.
  3. Go to Interactions in the Inspector.
  4. Next to Patch, click Create.
  5. Select Object Tap.

Two patches will be created:

  1. A producer patch representing the object.
  2. An Object Tap patch, connected to the producer patch.

a patch graph with a producer and Object Tap patch connected

Making an object respond to a tap

Next create a patch representing the property of the object you want to change. For this example:

  1. Select the object in the Scene Panel.
  2. Click the arrow next to Scale in the Inspector.

You could choose a different property instead. For example, Position to move the object to a different position or Visible to make it disappear.

Right-click in the Patch Editor and select:

  • A Loop Animation and Transition patch - we’ll use these patches to set how the object animates.
  • A Switch patch — to create a switch each time the object is tapped, telling the animation to start or stop.

You’ll see 6 patches in the Patch Editor:

A patch graph containing six patches.

Connect the patches, so your graph looks like this:

A patch graph containing six connected patches.

In the Transition patch, adjust the values next to Start and End to set the starting and ending scale of your object. We set:

  1. The Start value to 0.
  2. The End value to 4.

A patch graph containing six connected patches and edited values in one patch.


Why does my object respond (move, get bigger/smaller, rotate) even when not directly clicking on it?

Note the flower gets bigger when clicking anywhere on the plane object, represented by the blue square in the Viewport. This is because the Object Tap patch is responding to taps detected anywhere on the plane, even the parts that appear transparent because we've applied a transparent PNG texture.

 the image getting bigger when the user clicks directly on the flower and other parts of the plane

If we wanted the object to respond only to taps on the flower part of the texture, we would need to attach it to a 3D mesh object with a similar shape and size to the flower, instead of the square plane object. For example, a flat, circular mesh, made in external software.