SNAPCHAT AR: LENS STUDIO KEYBOARD

December 2018

As there is no built-in keyboard feature in Lens Studio yet, I decided to make one myself. One day there will be a real, proper keyboard in there, but I think this is a nice solution for now.

No programming is required to use the Keyboard, but it is possible to call certain functions
to interact with the keyboard with your own scripts (the list of features is at the end of this page).

 

 

 

lens studio keyboard

The keyboard now works for Lens Studio 2!
To install it in your project, simple import the .lso file or use the template project.

 

Make sure the keyboard object and all of its children are set to some custom layer (‘e.g. “Keyboard”‘).
Do this by clicking ‘select subtree’ on the root Keyboard item, and then making a new layer:

 

install lens studio keyboardinstall lens studio keyboard

The keyboard supports single-line and multi-line text, with as many lines as you’d like.

 

lens studio keyboard

 

There is a SHIFT button for capitals, and there are two more panels for symbols and numbers:

 

lens studio keyboardlens studio keyboard

 

  And you’ve got some customization options:

 

lens studio keyboard

Usage

To get the text typed by the user on a Text component, add the ‘GetKeyboardText.js’-script to your scene.

lens studio keyboard

 

 

 

 

 

 

To quickly change the colors/materials of the keys, simply edit the Materials in the Resources folder.

 

To set a default text, type it into the ‘Default Text’ textbox in the Keyboard settings (the root-level SceneObject).

 

To change the look of all keys simultaneously, delete all but one key in the ‘Keyboard/KeyboardCam/Keys’ object in the scene.
Simply change the look of the one remaining key to your liking, and duplicate it 32 times again (so there are 33 in total).
The Keyboard script will automatically place the duplicated keys correctly and add their labels and all that.

 

 

 

 

 

Javascript use (can be called from any script at any time):

 

global.KeyboardResult();

Function – Get the keyboard output. Use an int value (starting at 0) as optional argument to get a specific line! (E.g. ‘global.KeyboardResult(3)’ for line 2.)

global.KeyboardSwitch();

Function – Show/hide the keyboard toggle.

global.KeyboardVisible;

Bool (get) – Check if keyboard is currently visible.

global.KeyboardHideWhenRecording;

Bool (get, set) – Check if the Keyboard will be hidden when recording.

global.KeyboardMaxLines;

Int (get, set) – Get the amount of lines allowed to scroll through.

Keyboard in action

You asked for it – Custom text notifications! from r/SnapLenses

 
 
 
 
 
View this post on Instagram
 
 
 
 
 
 
 
 
 

Made a customizable keyboard for a #snaplens in #lensstudio – I’ll share the project files some time soon A post shared by max (@maxeflats) on

If you have any questions/suggestions, let me know!