Multiple Target tracking help!
Hey mods/nice community of lens creators,
I am trying to create a lens for a video that uses multiple marker targets in one lens that are synced with a video. Apoc showed me a script that allows for this to happen but I am having trouble triggering a particle system and a 3d model at different times... please if anyone can help me modify this script to allow this I would be eternally grateful!!
//@input Component.MarkerTrackingComponent m1
//@input Component.MarkerTrackingComponent m2
var event = script.createEvent('UpdateEvent')
event.bind(function(eventData) {
if (script.m1.isTracking()) {
// do stuff
}
if (script.m2.isTracking()) {
// do stuff
}
})
Thanks again!
hi Colin Tucker
thank you
Hi Colin,
Have you tried using Behavior script? You can set the trigger type to "Marker Tracking Event" and set the Marker Tracking component you want to respond to. Then you can set the delay time to cause something to happen that long after the marker is found. See more about Behavior script here: https://lensstudio.snapchat.com/guides/scripting/helper-scripts/behavior/
If you need more advanced behavior, you can write your own script that causes things to happen after a delay. Here's a really simple example:
And you can do the same thing for a second marker tracker too. Just keep in mind that if the marker is lost you might want to cancel all the pending delayed events. You can track them in a list and remove each one with script.removeEvent() when the object is lost if you run into this.
Let me know if you need more help!
Jacob