You could use other types of interaction patches to control visibility, like screen interactions
In this example, we'll make an object appear when a happy face is detected.
To try this out you can use your own 3D object, choose one from the AR Library, or use the plane object included in Spark AR Studio.
To add an object:
To do this:
This will open the Patch Editor, and create a patch:
To detect the presence and movement of a face in your effect, you'll need to add a face tracker to your scene:
Next create a patch to represent the face tracker, by dragging it into the Patch Editor.
Any patches that detect specific facial movements or gestures will need to be connected to this face tracker patch.
To create a patch that detects a specific gesture or interaction, right-click in the Patch Editor. You'll see a menu listing all kinds of patches - they're named to reflect what they do.
Under Interaction, you'll see lots of patches that detect facial movement and gestures - from Mouth Open, to Left Eye Closed, to Kissing Face.
To follow along with this guide, select a Smile patch from the menu.
Like many interaction patches, The Smile patch outputs a boolean signal. Boolean signals are either on or off. So if the person uses the effect smiles, the signal will be switched on, and the object will be visible in the effect.
If you want to show different objects in response to different gestures, all you need to do is:
Connect the interaction patches to the output of the face tracker, and the output of each interaction patch the input of the patch representing the object you want to show in the scene.
You can use the Counter patch to count through a series of options each time the same interaction is detected.
Combining the Counter patch with the Equals Exactly patch will tell Spark AR Studio to show a certain option, depending on the number of interactions counted.
Right-click in the Patch Editor, and select:
Connect the patches, so your graph looks like this:
You'll need to make a couple of edits to the values in the patches.
Make sure the Maximum Count in the Counter patch matches the number of options you want to count through. In this example, it should be set to 3.
Edit the value in the Equals Exactly patches. Each should show a number between 1 and 3, depending on which order you want them to show in the scene.