Patch Editor: Adding Logic With the Or Patch

You can use logic to make something happen in your effect in response to a specific set of conditions.

In this guide, you'll learn to use the Or patch to make something happen if either of two interactions are detected. We'll use the Head Rotation patch to animate an object when the head either leans to the left, or the right.

Add an object

To follow this guide, add an object to your scene - for example, your own 3D object, an object from the AR Library, or a plane.

Create the animation patches

Start by animating an object in the scene using animation patches:

  1. Right-click in the Patch Editor and select a Loop Animation and Transition patch.
  2. Select your object in the Scene Panel, and click the arrow next to Rotation in the Inspector.

To build the graph, connect:

  1. The Progress output in the Loop Animation patch to the Progress input in the Transition patch.
  2. The output of the Transition patch to the patch representing the rotation of the object.

Set the positions the object rotate between in the Transition patch:

  1. Next to End, set Y to 360

Finally, check the box next to Mirrored in the Loop Animation patch, to play the animation forwards, then backwards.

Your graph should look like this:

And your object should be rotating:

Add logic with the Or patch

Right-click in the Patch Editor and select a Head Rotation patch, and an Or Patch.

The Head Rotation patch is a face landmark patch. It needs to receive data from the face tracker, so add a face tracker to your scene and drag it into the Patch Editor to create a patch.


  • The Face output in the face tracker patch to the Face input in the Head Rotation patch.
  • The Turned Left and the Turned Right outputs from the Head Rotation patch to the inputs in the Or patch.

The output of the Or patch to the Enable input in Loop Animation.

Your final graph should look like this:

As a result, the animation will play if the head leans either left or right:

Was this article helpful?