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.
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.
Start by animating an object in the scene using animation patches:
To build the graph, connect:
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:
Use interaction patches animate objects in your effect.