Confine portal lens experience
Having a bit of an issue here, working on a portal lens (an interactive room) when the lens opens the user finds themselves in the room and does not walk into the portal.
Currently we are able to walk out of the portal. Is there anyway to restrict people from walking out the scene and confine the experience to only the room?
Hey Michael,
One way to work around this would be to center the user around the portal at start like you currently have, but set the device tracking on the camera to "Rotate" This would make it so the user can still look around the portal, but cannot move around inside it so they wouldn't be able to walk out!
Thanks so much for this feedback. As part of the experience the users are encouraged to walk around the portal, as they do they will trigger events so we are unfortunately unable to restrict their movement.
Hey Michael,
You can use the Portal Corners, to trigger if anything enter the scene or is outside of the scene.
Please refer to Portal Guide link here to learn more about how to setup portal corners.
Best,
Amir.
Hi Amir,
Thanks for the link. Im not sure if the triggers is what we looking for (I could be wrong though). We trying to confine the experience to only the portal, meaning you cant go through the walls/exit the lens just like they did with this Black History Month lens
https://wersm.com/snapchat-launches-virtual-art-gallery-lens-to-celebrate-black-history-month/
If this is done through the triggers how would we achieve this?
Hey Michael,
If you look through the Portal Guide that I linked in previous message you can see there is a part that has onPortalExit()
You can have line of code to turn on the black image as soon as you go out of the border of the experience.
You can use Tween System to have a nice animation for the black fade. Please refer to Tween guide down here to learn more about it.
https://lensstudio.snapchat.com/guides/scripting/helper-scripts/tween-manager/
Let me know if you have any questions.
Best,
Amir.
Hey Amir,
That's a solution yes, but what we're looking for is something similar to what was done in the Black History Month Snapchat lens where the user can't go through the wall at all. Snapcode below for the lens in question.
Please have a look at that lens and let me know what you think.
And thank you for your time, much appreciated by our team :)
Hey Michael,
I made a project file for you to demonstrate how you can achieve that effect.
Basically what it does is you specify boundaries for X minimum and X maximum same as for Y and also Z.
and what it does it moves the portal with camera based on the camera related to the boundaries that we defined.
Please take a look at the project file and check the "CameraBoundaryController.js" script.
Its pretty simple written and hopefully you will see how does it exactly working.
All the boundary objects are set as a child of the "Portal" scene object in your Objects panel.
Here is the link to the project file:
https://storage.googleapis.com/snapchat-lens-assets/f1a09194-f02d-43ed-92b8-62e843179ff0/lensStudio/Forum-Helpers/camera_boundary_example.zip
Hope this will help you.
Best,
Amir.
Hi Amir
Amazing, thank you so much! This is very much appreciated.
Hey Amir,
Just wanted to say thanks as well, we've managed to adapt your script to get the result we were looking for, awesome workaround !