Dual Lens with game
GUYS PLEASE I NEED HELP~
im trying to create a lens which has 2 different lens on it, like the front camera has only 3d mask while the back camera is a shooter game
please tell me how do i do this step by step;
1- how to create 2 diferrent lens on front and back camera
2- create a shooter game on lens studio
PLEASE REPLY ASAP!!!!!!
Hi Muneeb,
Unfortunately, we do not have a Shooter Game Template at this time. You can however take a look at the Interactive Guides here and under the “Interactive” menu on the left, learn how to use our available Interactive triggers to create games.
There is a way to assign different content to your front and back cameras though:
First, add a new empty object to your scene. Next, add the below script to it. Then, in the inspector panel, you can add objects to this script.
It will manage all objects that you want enabled on the front camera only and the back camera only. Note, make sure to not add this script to the objects you'll be disabling (because disabling the object will ultimately disable the script logic).
Here's the script, called "ShowOnlyOnCamera":
// @input SceneObject[] showOnlyOnFront
// @input SceneObject[] showOnlyOnBack
// -----JS CODE-----
function onFrontCamEvent(eventData)
{
for( var i = 0; i < script.showOnlyOnFront.length; i++ ){
script.showOnlyOnFront[i].enabled = true;
}
for( var i = 0; i < script.showOnlyOnBack.length; i++ ){
script.showOnlyOnBack[i].enabled = false;
}
}
var cameraFrontEvent = script.createEvent("CameraFrontEvent");
cameraFrontEvent.bind(onFrontCamEvent);
function onBackCamEvent(eventData)
{
for( var i = 0; i < script.showOnlyOnFront.length; i++ ){
script.showOnlyOnFront[i].enabled = false;
}
for( var i = 0; i < script.showOnlyOnBack.length; i++ ){
script.showOnlyOnBack[i].enabled = true;
}
}
var cameraBackEvent = script.createEvent("CameraBackEvent");
cameraBackEvent.bind(onBackCamEvent);
Please let us know if you have any further questions.
Cheers,
Neha
isnt there any tutorial on how to make games on lens studio? cus i think there should be one!
not everyone's a coder and know the complete system of lens studio. so it would be benefit for all of us if you could have a tutorial on how to make any games in lens studio
Hi Muneeb.
Currently we have this video tutorial from our team to help with creating games. We appreciate your feedback and are always working on new Guides and Tutorials, so keep checking back!
Cheers,
Neha
hey neha i tried ur ShowOnlyOnCamera script but its giving me this error
13:44:50 TypeError: cannot write property 'enabled' of null
at onBackCamEvent (camera.js:44) preventsyield
13:41:13 TypeError: cannot write property 'enabled' of null
at onBackCamEvent (camera.js:52) preventsyield
Hi,
Can you upload your project to google drive so i can take a look
hey n-mikael sorry mate cant do tht, since i cant share the project file with anyone, since this is my friends project which we are working on together.
if theres any way to fix the code error please tell