SNAPCHAT AR: LENS STUDIO KEYBOARD
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).
The keyboard now works for Lens Studio 2!
To install it in your project, simply 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:
The keyboard supports single-line and multi-line text, with as many lines as you’d like.
There is a SHIFT button for capitals, and there are two more panels for symbols and numbers:
And you’ve got some customization options:
To get the text typed by the user on a Text component, add the ‘GetKeyboardText.js’-script to your scene.
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.
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.)
Function – Show/hide the keyboard toggle.
Bool (get) – Check if keyboard is currently visible.
Bool (get, set) – Check if the Keyboard will be hidden when recording.
Int (get, set) – Get the amount of lines allowed to scroll through.