Switching through face masks with tap
I'm trying to use a script (shown below) for switching through multiple face masks when the user taps the screen.
The problem is only the first face mask is aligned to the face, the rest are not.
Is there a way around this issue?
//@input Component.FaceMaskVisual visual
//@input Asset.Texture[] postEffects
var count = 0;
function onTapped(eventData)
{
script.visual.mainPass.baseTex = script.postEffects[count]
if(count < script.postEffects.length - 1){
count++
} else
{
count = 0
}
}
var event = script.createEvent("TapEvent");
event.bind(onTapped);
Hi loupis1,
Have you tried the Full Screen Template? Check out this thread for guidance on how to achieve switching through face masks with tap without scripting.
Cheers,
Neha
Thanks Neha! I'll check out that thread.
How about a way to make the face mask texture fade in when it is activated?
Heya!
I think your original script is a great way to switch between face mask textures! My suggestion would be to download the face mask reference points texture in the Face Paint Template. It's in the resources under Textures > Face Substitution Points. Download the full image and then center all your face mask textures around those reference points. Then, when you switch the face mask, they will all be in the same place on the face!
If you can't do that, you could simply create a face mask for every texture you have and enable/disable based on the count, however, this method isn't as well optimized as the one above.
For fading your masks in, you can add a TweenAlpha script for your mask, and trigger it using the behavior script!
Cheers,
Ben