Confetti Cannon Trigger (Help)
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.
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!
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 :)
I believe I have double checked everything you recommended but it still is not activating. Here is a dropbox link to the file:
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:
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.
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:
Can't wait to see what you come up with :)