Tap plane to position object

  • *bump*

    I don't need exact instructions, but can anyone tell me is this even possible? :) Thanks!

    Comment actions Permalink
  • Hi Steven,

    The easiest way to do this is to start with the WorldObjectController object disabled in the Objects panel, and enable it through script on SurfaceTrackingReset event. Here's a simple script that will do just that:

    //@input SceneObject target
    script.createEvent("SurfaceTrackingResetEvent").bind(function(){
    script.target.enabled = true;
    });

    Just create a new SceneObject, add this script onto it (bound to Initialized event) and set "target" to the WorldObjectController object. And make sure the WorldObjectController object is disabled in the Objects panel.

    Note that this event doesn't fire in Lens Studio, only on device. So if you want to test it in Lens Studio, you can also add this code to the end of that script:

    // For testing in Lens Studio
    script.createEvent("TapEvent").bind(function(){
    if(global.scene.getCameraType() == "back"){
    script.target.enabled = true;
    }
    });

    Hope this helps! Let me know if you have more questions about it.

    Thanks,
    Jacob

    Comment actions Permalink
  • Hi Jacob,

    Thanks a lot for your help!

    Can you please elaborate more on the "set "target" to the WorldObjectController object" part? Do I set it inside the script, too? Because I see no other interface element to do it.

    Sorry for the newbie questions, I'm very new to Lens studio.

     

    Thanks again!

    Comment actions Permalink
  • Hi Steven,

    1. Create a blank script by clicking Add New > Script in the Resources panel
    2. Select the script, paste the code into the text editor in the Inspector panel and click Apply changes
    3. Add a new SceneObject by clicking Add New > Empty Object in the Objects panel
    4. Select the new object and add the script to it by either A) Dragging the script from the Resources panel into the Inspector panel, or B) Clicking "Add Component" in the Inspector panel, clicking Script, clicking Add Script, then selecting your script.
    5. You should now see this in the Inspector panel: 
    6. Click in the box that says "None" next to "Target" and select the object you're trying to hide (WorldObjectController if you're using one of the surface object templates.)
    7. Make sure the object you want to hide is disabled. You can do this in the Objects panel by unchecking the box to the right of the object's name.

    Let me know if you need more help!

    Comment actions Permalink
  • Hi Jacob,

    That's exactly what I did the first time, but I can't seem to get the "Target" field to appear:

     

    Comment actions Permalink
  • @Jacob: Actually, nevermind, I started a new project from zero and now I see the Target field. :) Works like a charm.

    Thanks a lot for your patience, and especially for the help!

    Comment actions Permalink
Have a comment?

Please sign in to leave a comment.

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?

Version

Graphics

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:

Name:

Email:

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!