Hand Joints
The Hand Joints template allows you to attach different screen effects to 25 joints found on the hand, as well as to create triggers with your own custom hand gestures.
This template differs from Hand Gestures template as it allows Lens Creator add their own hand gestures and also supports full number of available hand joints
Video Walkthrough
Template Walkthrough
Hand Tracking Joints
The Hand Joints Template provides 25 2D screen points that represent joints on the hand. You can find all of the joint objects under the Hand Tracking Controller object.
These joints are referenced in the HandTrackingController
script under the Advanced
section and its relationship to each other is used to calculate the current “gesture” of the hand
Each joint uses the same Object Tracking component used in pet, shoulder, and body tracking
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.
You can see an example of how joints are tracked by turning on the joint debug view. To do this just enable Debug Joints object.
Hand Triggers
By knowing the position of each hand joint, we can understand how the user’s hand is shaped. We can use this to detect a “hand gesture” that the user is doing in order to trigger an effect.
Let’s take a look at the Hand Trigger
script to see this in action.
Using Custom Gestures
Disable Is Default Gesture
flag in HandTrigger
script to show the Custom Gesture
option. It allows you to specify name of any gesture that is stored in HandGesturesController
script.
To add a custom gesture, tap the preview screen at the moment you see the gesture to detect, and the Lens will print out the relative position of the joints to the Logger
panel.
Then you can copy that line to HandGestureLibrary and name your new custom gesture!
This is the same technique found in the Full Body Trigger template
Default Gestures
For convenience, you can also detect the built in gestures using same script. When Is Default Gesture
is selected you’ll see menu with all available options.
Adding trigger response
Now when your trigger is bound to default or custom gesture, you can specify trigger response. In this template we use Behavior Scripts to do so.
Response On Start: name of Behavior Custom Trigger to be called when gesture is detected
Response On End: name of Behavior Custom Trigger to be called when gesture is no longer detected
You can find On Start
and On End
objects with attached Behavior scripts under each Hand Trigger object.
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!
Hand Segmentation
Feel free to mix and match this technique with other capabilities. The Hand Joints Template also comes with a segmented Hand Mask image for you to use! To preview it just enable Hand Mask
object in Objects
Panel.
Switching Preview Video
When working with this Template, you’ll want to switch the preview video to one with a person’s hand. In the Preview panel, select the Image / Video Mode button.
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.
Previewing Your Lens
You're now ready to preview your Lens experience in Snapchat! To do so follow the Pairing to Snapchat guide.
Related Guides
Please refer to the guides below for additional information: