Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1.Start a new project in Lens Studio
- 2.In the Objects pannel select `add New` -> `billboard`
- https://imgur.com/ScMwh9Q
- This creates an orthogonal camera and a 2D sprite that is set to cover the screen by default.
- 3. Uncheck the tick box next to `Sprite` in the Inspector pannel, so that it is initially hidden.
- https://imgur.com/znBMkN6
- 4.In the Resources pannel select `add New` -> `script`.
- https://imgur.com/8Ai7Fzv
- 5. Select this script and in the inspector pannel change its contents to:
- // -----JS CODE-----
- //Add inputs which can be acccessed using script.inputName
- //@input Component.Camera camera
- //@input Asset.Texture deviceCameraTexture
- //@input Component.SpriteVisual spriteVisual
- //Takes a screenshot which we can access with textureCopy
- var textureCopy = script.deviceCameraTexture.copyFrame();
- //Applies textureCopy to the sprite
- script.spriteVisual.mainPass.baseTex = textureCopy;
- //Shows the sprites visual that was hidden in step 3
- script.spriteVisual.enabled = true;
- https://imgur.com/QBZN6zU
- 6. Select the 2D sprite added in step 2 and add a script component in the Inspector pannel.
- https://imgur.com/9UUgLwp
- 7. Select `Tapped` in the drop down next to the newly added script so it runs when the user taps.
- 8. Finally set the inputs you added in script (using @input)
- camera -> Orthographic Camera
- device camera texture -> Device Camera Texture
- Sprite Visual -> 2D sprite
- https://imgur.com/GuWoiKK
- Credit to u/maddogmular for the script since I have only slightly altered theirs.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement