Skip to main content
Version: 5.x

Full Body Triggers

To make it easier for you to mix-and-match our different examples, this template has been converted to an importable asset in the Asset Library with the name Full Body Trigger - T Pose, Full Body Trigger - Screen and Full Body Trigger - Distance.

The Full Body Trigger Template allows you to trigger different screen effects with different body movements, such as custom body gestures, touch screen triggers and distance check between joints and screen elements.

The Full Body Attachment template differs from the Skeletal as it requires the user to be even further from the camera in exchange for more joints tracked as it uses the Full Body Tracking system rather than the Upper Body Tracking system . In addition, instead of Head joint it provides access to the face points such as Nose, Eye Left/Right, Ear Left/Right.

Tutorial

Guide

To create your own Full Body Trigger Lens you will need:

  • Triggers: This can be body gesture, distance check between body joints, or distance check between body joints and a screen transform
  • Trigger Responses: What should happen when a trigger occurs: e.g. triggering Behavior, playing tweens etc.
  • Visual Effects: This can be full screen effects, visual effects attached to the body, or anything else that you want Trigger Response to use

Switching Preview Video

When working with this Template, you’ll want to switch the preview video to one with a person’s body. In the Preview panel, select the Image / Video Mode button.

Then, in the drop down at the top of the Preview panel, choose the Dance or the Skeletal preview video.

Record your own videos or make photos and set them as a lens studio preview by clicking on + From Files button at the bottom of the preview panel dropdown list.

You should now see the content tracked to the body in the video. You can also switch to Webcam Mode to see the content attached to yourself.

Full Body Tracking

The Full Body Tracking provides 2D screen points that represent user’s joints / parts of the body. It is the basis of this template.

You can find all the joint objects underFull Body Tracking Controllerand on the FullBodyTrackingController script under Advanced section.

To attach mesh or images to a certain joint, just put the object as their child or use Pin to Mesh to connect them to the joint. In this template we have attached simple 2D colored dots.

You can preview how joints are tracked by turning on the joint debug view. To do this go to JointDebugHelper under the Helper Scripts [EDIT_ME] object and check Show Debug Joints.

Movement Trigger Types

Under Effect Trigger Examples you’ll find a few objects each with the MovementTrigger script attached such as

  • T Pose
  • Right Foot Click
  • ScreenTrigger Swarm
  • ScreenTrigger Party Hat.

Each of these objects has a MovementTrigger script attached to them. The MovementTrigger script allows you to set up triggers with different Movement Types. There are 3 different movement types: Gesture, Screen Trigger and Distance.

Gesture

T Pose and Right Foot Click uses Gesture as their movement types.

Each Gesture is composed of a list of pose triggers listed in the Gesture Poses input field. For example, the pose triggers for Right Foot Click are RIGHT_LEG_OUT and RIGHT_LEG_CLICK. Each of these poses are defined in the GesturesLibraryscript.

When the first pose is matched to the user in the camera, with tolerance of the value of Threshold, the list of Behavior triggers in Start Trigger is called. Similarly, when the last post is matched, the list of Complete Trigger is called.

You can add a custom pose to the GestureController script by tapping the screen at a certain time, it will print out the relative position of the joints at the time of the tapping.

Then you can copy the printed message and paste it into the GestureLibrary script and create your own pose!

You can also remove some of the values (name and value) provided by the logger message if those joints don’t matter for your pose.

Touch Screen Trigger

The ScreenTrigger Swarm object and ScreenTrigger Party Hat object uses Touch Screen Trigger as their Movement Type in MovementTrigger script.

In this case Touch Screen Trigger is related to the body’s joint “touching” the screen transform area based on the camera video, not touching the device screen. To learn more about screen touches on device, check out this guide.

In this mode you’ll input a ScreenTransform as the trigger area and select a joint from the drop list, then the script will check the distance between the joint and the screen trigger. It will send out Start Trigger and Complete Trigger if distance is smaller than the Threshold value.

Because screen trigger is instantaneous in comparison to gesture trigger, the effect here often checks Has End Time and is given an Effect Length.

Distance Check

Distance Check checks the distance between two joints and compares it against the Threshold, and sends out Start Trigger and Complete Trigger if distance is smaller than the Threshold.

Distance Modifier

Different from Distance Check in MovementTrigger, Distance Modifier takes the distance between Main Joint and Target Joint or Target Object with a screen transform component and uses the distance to change a given Parameter on a material.

In the case of the example, the distance between left and right wrists is modifying a pixelated full screen effect.

Movement Trigger Response

Under each object in Effect Trigger Examples, there is a Response object with a MovementTriggerResponse script.

Each response object handles calling the visual effects for each trigger. They communicate through a Behavior Custom trigger string. We need to make sure that the Start and End trigger strings match each other in the MovementTrigger and MovementTriggerResponse script.

In the MovementTriggerResponse script, there are four different response types:

  • Trigger Objects: Objects here will be turned on when trigger is started, and off when trigger ends
  • Trigger Tweens: Objects here with tween scripts attached to them will have their tween triggered with the tween name same as Fade In Tween and Fade Out Tween found in the Advanced section of the Script component (by default it is ‘FADEIN’ and ‘FADEOUT’).

  • Trigger Animated Textures: Animated textures input here will be started and stopped when the trigger starts and stops.
  • Particle Bursts: Particle Systems with the ParticleControllerHelper script attached will have a ‘burst’ effect triggered when the trigger starts. Make sure External Time and Instant Spawn are both checked on the Particle System material so that the ParticleControllerHelper script can modify the parameters.

Behavior Response

You can also respond to Movement Triggers by using Behavior scripts. For example, on the FootClick_Response_Behavior object, all animations and fullscreen effects are triggered with Behavior scripts.

Each Behavior script is set to run on a custom trigger with the trigger name corresponding to the triggers in MovementTrigger.

The advantage of using Behavior scripts is having a very wide range selection of responses and having delays to the trigger as well.

To learn more about Behavior script, check out the official Behavior Script guide!

Previewing Your Lens

You're now ready to preview your world Lens experience. To preview your Lens in Snapchat, follow the Pairing to Snapchat guide.

Was this page helpful?
Yes
No

AI-Powered Search