Skip to main content
Version: 4.55.1

3D Objects

The 3D Objects Template shows you how to attach 3D objects to a face or multiple faces. For multiple faces, the 3D objects for each face can be the same or different. This template also includes a helper script to play looping animation on the 3D objects.

Tutorial

Guide

Exporting 3D Content

The 3D Objects Template assumes that you have a 3D object which you'll be importing into Lens Studio. To make your 3D object ready for import into Lens Studio, follow the 3D Object Export guide.

Importing 3D Content

Once your 3D object is exported, follow the 3D Object Import guide to import your 3D object into Lens Studio.

Adding the Face Object

After importing, the 3D object will be automatically included in the Objects panel and should also be visible in the Scene panel. Drag your newly imported object to be a child of the FaceObjectContainer [EDIT_ME] object found under First Head. This will attached the object to the first head found in the camera. You can now delete the template's placeholder content labeled with [REPLACE_ME].

Tuning the Object's Transform

In the Scene panel, you can position, scale, rotate the world object relative to the head. In the Lens, the face object will automatically be locked to the face as shown in the Preview Panel.

Playing an Object’s Animation

You can play animation on 3D objects by using the helper script IdleAnim. To do this, in the Inspector panel select Add Component -> Script followed by Add Script -> Scripts -> IdleAnim. Set the Animation Mixer property in the Inspector panel to your 3D Object’s AnimationMixer component. Next, set the property Idle Anim Layer to the name of your animated object's animation layer.

Optionally, you can add music by dragging and dropping your mono channel mp3 into the Resources panel and adding it to the Idle Anim Audio field.

Adding a Second Face Object

To add 3D objects to the second face, repeat the same process as above, but place it under the FaceObjectContainer below the Second Head. The Lens will automatically show and hide the object as needed depending on the number of heads visible.

Previewing Your Lens

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

Script Interface

IdleAnim.js

  • Animation Mixer (Component.AnimationMixer) - A reference to the world object's Animation Mixer component
  • Idle Anim Layer (string) - The name of the anim layer that should be played for the idle animation. The anim layer name is configured in your external 3D editor. The anim layer name is also listed in the object's Animation Mixer component
  • Anim Audio (Asset.AudioTrackAsset) - A reference to an mp3 file. If set, the inputted audio will play alongside your animation

Please refer to the guides below for additional information:

Was this page helpful?
Yes
No