Cycle through different objects/effects
Hello, I am trying to create a lenses with cycle through makeup, freckles and particles, tapping on a button for each effect.
I can at this point make a lenses with a button to toggle between, or cycle through an object or effect. But not different buttons to different objects or effects.
I have been playing with behavior scripts but I can't seem to get it to work right. When i try everything will cycle simultaneously.
Can anyone help me?
yes we can, can you create example project of what you want and i can help you with it
Hi, Kulebriller!
So basically with the tap on each button you need to hide all objects except of the one you need.
Let's try to implement it :
I created two inputs :
1. array of strings for trigger names
2. array of sceneObjects to enable and disable
and set them all with my parameters :
Now I'll add responses on those triggers
for ( var i = 0; i < script.triggerNames.length; i++){
global.behaviorSystem.addCustomTriggerResponse(script.triggerNames[i], getCustomTriggerCallback(i))
}
function getCustomTriggerCallback(index){
return function () {
hideAllButOne(index);
}
}
function hideAllButOne(current){
for(var i = 0; i < script.sceneObjects.length; i++){
if(script.sceneObjects[i]){
script.sceneObjects[i].enabled = i == current;
} else {
print("SceneObject " + i + " is not set");
}
}
}
This script could be written in a million different ways, so feel free to change it
At the beginning enable and disable objects you want in the Objects panel
The project is here
Best
Olha
Hello, and thanks :)
This was my attempt before the answers came...
https://www.snapchat.com/unlock/?type=SNAPCODE&uuid=587ce432a30444fc9b0008d31a287a52&metadata=01
Gonna try update it or change theme.
Thank you very much :) stay safe :)
It's cute! Thanks for sharing!