The forum on this site is closed for new comments and posts. Continue the conversation in the new forum, and learn more here.

Tap to Trigger Billboard and Sound

  • Ha Ha I built same thing.. but so less elegant ! great work again Travis!

    Comment actions Permalink
  • This seems to block the manipulate component from working. Maybe I'm doing it wrong but how can you use this along with manipulation?

    Comment actions Permalink
  • Hi Carly, this shouldn't block the Manipulation component where you are able to drag, rotate and scale the object in the scene. What it does block is the ability to tap the ground to replace the content. This is because by adding a full screen tap, you are taking away the ability to tap the ground. Unfortunately, there's not really a way around this because you can't know the user's intent (do they want to tap the ground OR tap the full screen). 

    I was able to have this scripting running alongside the manipulation component (drag, scale and rotate) by following these steps:

    • Create a new Animated Object template project
    • Add a new object to the screen (outside of the WorldObjectController) and add the ShowBillboardOnTap script in the post
    • Add a new billboard and link it in the ShowBillboardOnTap
    • In the preview panel you can click and hold to drag the object in the scene (the manipulation component at work). And, you can tap the screen as well and the billboard will appear. 
    Comment actions Permalink
  • How do you link It? I linked the script to the new object and the ground grid will move but not the object.

    Comment actions Permalink
  • Your custom object needs to be a child of the WorldObjectController in the templates to have the ability to manipulate. To do this, drag your custom object onto the WorldObjectController object in the Objects panel. This will make the object a child of WorldObjectController. 

    Comment actions Permalink
  • Is ist possible to make the billboard dissapear in a few seconds?

    Comment actions Permalink
  • Try this, now has a configurable showTime which is how long the billboard is active:

    // -----JS CODE-----
    // @input Component.SpriteVisual billboardSprite
    // @input Asset.AudioTrackAsset audioTrack
    // @input float showTime = 1.0

    var audioComponent = null;

    function onTurnOn( eventData )
    global.touchSystem.touchBlocking = true;
    global.touchSystem.enableTouchBlockingException("TouchTypeDoubleTap", true);
    global.touchSystem.enableTouchBlockingException("TouchTypeSwipe", true);


    if( script.billboardSprite )
    script.billboardSprite.enabled = false;
    var turnOn = script.createEvent("TurnOnEvent");

    function onTap( eventData )
    // Show billboard
    if( script.billboardSprite )
    script.billboardSprite.enabled = true;

    // Start the delay

    // Play animation
    var control = script.billboardSprite.getMaterial(0).getPass(0).baseTex.control;
    if( control && )
    {, 0.0);

    // Play sound
    if( audioComponent )
    { 1 );
    var tap = script.createEvent("TapEvent");

    function onDelay( eventData )
    script.billboardSprite.enabled = false;

    var delayedEvent = script.createEvent("DelayedCallbackEvent");
    delayedEvent.bind( onDelay );

    function audioSetup()
    if( script.audioTrack && !audioComponent )
    audioComponent = script.getSceneObject().createComponent("Component.AudioComponent");
    audioComponent.audioTrack = script.audioTrack;
    Comment actions Permalink
  • Thank you for the great script!

    Is there an easy way to make this work to tap through multiple billboards? (For instance, if I wanted three different billboard options, tapping again would switch to the second billboard, and then tapping another time would switch to the third.)


    Comment actions Permalink
  • Hi Rhonda! We actually recently released a template that makes this really easy. It's called the fullscreen update and it's in the latest version of Lens Studio. You just need to update to get it. 

    Basically, it allows you to setup "states" that transition to other states via a tap or wait. Each state defines what objects are shown (e.g. billboard), what animations to play and what audio to play. You are able to use the template to do what you want without any scripting. 

    Check out the tutorial video here:

    Hope that helps!

    Comment actions Permalink
  • I was able to use the fullscreen update to trigger a few billboards showing up one at a time on top of a 3D object, then drag all of them altogether. It's exactly what I wanted. However, now i tap anywhere on the screen and that would enable the billboards. How can I make it so that the billboards would only appear when I tap on the 3D object? (just like when I used your script above) 

    Comment actions Permalink
  • Hi Sandy, 

    In the Inspector panel of the object where your script is located, you can add a TouchComponent and define a MeshVisual which the touch event will listen to. 

    Now, the TapEvent should only respond to touches that touch the MeshVisuals in the list. 

    Let me know if you need any clarifications!


    Comment actions Permalink
  • Although the script works in the preview, I keep getting the following error and can't publish my lens:

    12:06:57 Error: Wrong argument number count, expected 1, got 2
    at [anon] () native strict preventsyield
    at onTap (BillboardSprite:34) preventsyield

    I tried switching to the second version you posted (with the showTime) and it gave me the same error:

    12:06:57 Error: Wrong argument number count, expected 1, got 2
    at [anon] () native strict preventsyield
    at onTap (BillboardSprite:38) preventsyield

    Line 34 (and 38 on the second version) are both:, 0.0);

    Any idea why it isn't working?


    Comment actions Permalink
  • Hi Jessie, 

    Is the texture you are using a video? If it is, can you remove the second parameter in the function on line 34 and 38)?;

    Unlike animated texture, the video texture does not allow you to set the offset from where the texture is played. 

    Let me know how it goes!



    Comment actions Permalink
  • Jonathan - this fixed it but I think the video may have been too large because after that error was resolved, it started giving me an error saying that it was an invalid file (with the directory of my file). I ended up switching to a jpg image sequence (I used as many sprite sheets as possible but it's still pretty low res, unfortunately) in order to stay under the 4 mb limit. Now I am just dealing with an unrelated issue of my billboards not staying in proportion to each other when viewing on different devices - so I will have to start a new thread! Thank you though!

    Comment actions Permalink
  • Hi,


    I just signed up for the platform.

    I am currently studying interaction design and planing a project for the year end show using sound. I saw this thread and wanted to ask your opinion about it.

    My idea is to have an empty food platter that will have the AR stickers for each type of food. Scanning the sticker will trigger a 3D visual and a voice telling the story about this food, where did it grow, what is it, etc. Can I trigger sound (a short narration) like that? Would you have any suggestions, recommendations?

    Thank you in advance for your time!


    Comment actions Permalink
  • Hi Irem! 

    Take a look at the Marker Template for an example how you can have the Lens recognize a sticker:

    Additionally, you may want to take a look at Behavior Script, which allows you to trigger things based on some event: 

    Let me know if you need any clarifications!


    Comment actions Permalink

We're here to help! We just need a little bit of information...

What system are you using?

Have you downloaded the latest version of Lens Studio?

Please download the latest version of Lens Studio. If you still run into this issue, please come back and report it!

Is this issue causing Lens Studio to crash?

What system do you run Lens Studio on?



Follow the next steps to help us solve your issue:

  • Copy and paste this text into your TerminalCommand Window
    open ~/Library/Preferences/Snap/Lens\ Studio/ %LOCALAPPDATA%\Snap\Lens Studio Copy Text
  • Press ReturnEnter to run the command. The Lens Studio folder will automatically open
  • Prepare to upload your files: zip the "Log" Folder by right-clicking and choosing "compress."
    Locate the Log.txt file right above it.

    Attach a screenshot of the issue:



What is this most relevant to?

Please enter a brief description of your issue:

Thanks for submitting this issue.

Unfortunately, it's likely due to the operating system or hardware you're using – since they don't meet the system requirements for Lens Studio.

Still, we hear you loud and clear, and are logging the issue in case there's ever a workaround we can provide!

Minimum Requirements

Operating System: Windows 10 (64 bit); MacOS 10.11+

Hardware: Minimum of Intel Core i3 2.5Ghz or AMD Phenom II 2.6Ghz with 4 GB RAM; Intel HD Graphics 4000 / Nvidia GeForce 710 / AMD Radeon HD 6450 or better; screen resolution of 1280x768 or higher

We'll try to resolve this issue as soon as possible. Thanks for letting us know about it!

Keep an eye out for a followup email from us. We may have a couple more questions for you, or we might already have a solution to offer.

Happy creating!