Confetti Cannon Trigger (Help)
Hey All,
I am attempting to make a confetti cannon set off by a facial trigger; the end goal is to have a lens that shoots a confetti cannon into/above the users face and then the confetti falls naturally around them due to the effects of gravity. I know the traditional way would be to create a sprite animation which I am inexperienced with, but because the action is so similar to a particle effect I was wondering if there is anyway to use a trigger in tether with the particle effect to create bursts of confetti activated by facial triggers?
Any help at all would be appreciated. Thank you.
Hi Otfcodyp,
Sounds awesome! Let's do it.
First lets make our particle use external time--that way we can set when we want the particle to play. In your Resources panel, select your particle's material, and in the Inspector panel tick "External Time"
Then let's create a new script to control this External Time parameter.
In the Objects panel, select the object which contains your particle's Mesh Visual. Then, in it's Inspector panel press "Add New" and select script. Press "Add Script". In the dialog box, press "Add New" > Script.
Then locate this new script in your Resources panel and edit it.
In this script we first want to access the Mesh Visual so we can access the particle.
Then we'll set up a variable to track the start time of our particle. We'll also create an event which will set this variable when the user opens their mouth.
Finally, on every frame update after the user has opened their mouth (startTime is set), we can calculate how many seconds have elapsed since then and set that as our particle's external time!
So our final script looks something like:
Let me know if I can clarify anything. Can't wait to see what you make!
Cheers,
Jon
Hey Jon,
Hi Otfcodyp,
The particles stopping is a good first step--since it will allow us to start the particles!
Do you see any error in the Logger panel?
Just to make sure: Is the script attached to the same object as where the particles' mesh visual is attached (see screenshot above)? And please make sure the script is set to initialized. Finally don't forget to open your mouth, since that is what we set the script to trigger on.
If it's still not working, yes the file will definitely help :)
Thanks!
Jon
Hi Jon,
I believe I have double checked everything you recommended but it still is not activating. Here is a dropbox link to the file:
https://www.dropbox.com/s/xj5x9lkkxz8xt90/Confetti%20Filter%20Newest%20Test%20Zip.zip?dl=0
Thanks!
Hi Otfcodyp,
Thanks for sending the file! This Lens is looking cool.
Should I be looking at the Splat particle? I can't see the particle system even when I turned off External Time?
But I did notice a few things:
Thanks!
Hi Jon,
I found the problem I was having and the script is working great now, thank you for your help! The final problem I am having is in terms of submitting my lens for use; the current size is 6.75 mb and I am trying to reduce it down to the 4 mb limit. I have already tried the optimization feature that removes my unused objects/resources and it is still too large. Below is a link to the new file, please let me know if you have any suggestions/tips for decreasing the size.
Thanks!
https://www.dropbox.com/s/pqoodmkqlozawya/Compression%20Test.zip?dl=0
Hi Otfcodyp,
Glad to hear you got it to work!
I took at the file you uploaded, it looks like some of the png can be compressed to reduce Lens size. For example, "floating on top Sticker_0" can be reduced several mb. You can use something like TinyPNG.com to help you with this. Please take a look at the following pages for additional information:
https://lensstudio.snapchat.com/guides/2d/2d-optimization/
https://lensstudio.snapchat.com/guides/submission/performance-and-optimization/
Can't wait to see what you come up with :)
Cheers,
Jon