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 make something happen when the head either leans to the left, or the right. The behaviour these patches will drive is the animation of an object, using the Loop Animation and Transition patches to move the object between two different positions.
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.
Let's start by animating an object in the scene:
Set the positions the object rotate between in the Transition patch:
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:
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 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: