Get custom trigger into a script
Hi,
I am using the 3d hand gesture template and inside there are Gesture Triggers, e.g. Thumbs_Up in the inspector where the script GetJointDistanceManager is used. I want to make the gesture control the visibility (or if I can animate the opacity so they fade in) of some post effects so that on the first time it is triggered it shows the object, the second time it hides it, the third time is shows it and continues as so.
I can't seem to find how to access the Send Triggers -> Gesture Detected and Gesture Lost into a script I am writing to make Gesture Detected control the object's visibility.
Here is the template I am using: https://docs.snap.com/lens-studio/references/templates/object/3d-hand-interactions
Edit 1: I've added a tween to activate script api when the custom trigger from one of the Gesture Triggers but it doesn't seem to read the value in my script and gives this error even though the function name is in the script I'm using:
23:33:59 [Scripts/Behavior.js:559] [Set Effects] Script API missing function named 'togglePostEffects'
Edit 2: Solved by making a function set to
script.api.functionName = function() {...}
so it can be accessed outside of the script and be triggered by a behavior script taking the custom trigger in, set response to call object api, add my custom script as the script component and call type as call function, to my function name there
For setting properties, api.script.varName also needs to be used