Face Trigger in Fullscreen Template
Hi all,
I'm using the Fullscreen Template scripts to advance through different states of visible objects, sounds, and animations (a series of headwear in this case.) Everything is working perfectly, but it only works by tapping. Is there any way to add functionality to advance states by opening the mouth, raising the eyebrows, etc.?
I'm very new to scripting in general, so any help would be appreciated!
Hi Thomas,
Yup! we just need to do a little script editing.
First open the FullscreenTemplateState.js script by double clicking it in the Resources panel, under the script folder:
Then, we can add a drop down to show us the different triggers we can use. I grabbed the following line from the script in the Face Trigger template and pasted it on line 51 of FullscreenTemplateState.js.
// @input string trigger = MouthOpenedEvent { "widget": "combobox", "values": [ { "label": "Brows Lowered", "value": "BrowsLoweredEvent" }, { "label": "Brows Raised", "value": "BrowsRaisedEvent" }, { "label": "Brows Returned To Normal", "value": "BrowsReturnedToNormalEvent" }, { "label": "Face Found", "value": "FaceFoundEvent" }, { "label": "Face Lost", "value": "FaceLostEvent" }, { "label": "Kiss Finished", "value": "KissFinishedEvent" }, { "label": "Kiss Started", "value": "KissStartedEvent" }, { "label": "Mouth Closed", "value": "MouthClosedEvent" }, { "label": "Mouth Opened", "value": "MouthOpenedEvent" }, { "label": "Smile Finished", "value": "SmileFinishedEvent" }, { "label": "Smile Started", "value": "SmileStartedEvent" }, { "label": "Touch Start", "value": "TouchStartEvent" }, { "label": "Touch End", "value": "TouchEndEvent" }, { "label": "Tap", "value": "TapEvent" } ] }Now, when you select a state, in the Inspector panel you should see a new trigger dropdown:
Finally, we need to use this drop down value. On line 242 of the FullscreenTemplateState.js , we have the line:
var touchTapEvent = script.createEvent("TouchStartEvent");We can replace "TouchStartEvent" with "script.trigger"
Now, you should be able to move to the next state based on your selection in the trigger drop down!
Can't wait to see your final result! Don't forget to share once you're done :)
Cheers,
Jonathan
Hi Jonathan,
Thanks a ton, that was so quick and painless!! The project isn't quite final yet, but here's a link to a video of the prototype/proof of concept: https://vimeo.com/294667192/840b6d9ee3
Thanks again!
Thomas
Wow that looks awesome! I'm excited!
Hi Jonathan,
I thought you might want to see how everything ended up!
https://vimeo.com/321798454/f704a86bcc
is there a way to have the animation/object appear on screen only when mouth opens, and as the mouth closes the animation/object dissapears?