• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by unity_GoUPPA2hUMGrPA · Jun 07, 2019 at 09:12 AM · renderervuforiaaugmented realityinvisible

How can I keep objects invisible when vuforia ImageTarget is lost and found again?

I have several objects inside an ImageTarget. When I click on one of this objects the others dissapear (I disable the mesh renderer component of these objects).

My problem is that if the target is lost and refound, all objects come visible again.

How can I keep these objects invisible even if target is lost?

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Magso · Jun 07, 2019 at 01:33 PM 0
Share

You could make a boolean that turns true when a target has been picked and have the other objects check when that boolean is false again before they come back on.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by kwalkup · Jun 12, 2019 at 02:18 PM

I believe you can do this by editing the Vuforia script, "DefaultTrackableEventHandler" that is attached to you Image Target. See this method on line 84 (under region "PROTECTED METHODS").

I would add a case for if an object is clicked, like a bool isClicked.

(This code was not tested!) ( Also I apologize for the odd formatting, this is my first time posting an answer.)

  // add private bool isClicked;


 protected virtual void OnTrackingFound()
 {
     var rendererComponents = GetComponentsInChildren<Renderer>(true);
     var colliderComponents = GetComponentsInChildren<Collider>(true);
    var canvasComponents = GetComponentsInChildren<Canvas>(true);
 
        if (isClicked == false)
        {
              //Vuforia's code:
               
              // Enable rendering:
               foreach (var component in rendererComponents)
               component.enabled = true;
 
              // Enable colliders:
             foreach (var component in colliderComponents)
             component.enabled = true;
 
           // Enable canvas':
            foreach (var component in canvasComponents)
             component.enabled = true;
       }
     else if(isClicked == true)
      {
         
            
               foreach (var component in rendererComponents)
               component.enabled = false;
 
              
             foreach (var component in colliderComponents)
             component.enabled = false;
 
           
            foreach (var component in canvasComponents)
             component.enabled = false;


       }
 }

I hope this helps, or at least steers you in the right direction! (:

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image unity_GoUPPA2hUMGrPA · Jun 13, 2019 at 07:13 AM 0
Share

Thank you for your help. $$anonymous$$y problem is I'm so nooby with unity. I don't know how to attach this bool to every object.

I tried to add the variable in a script and then I attached the script to every object but then when I edit de Vuforia Script my script (and variable) are not accesible from here.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

120 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Renderer on object disabled after level reload 1 Answer

Evernote API in Unity using Vuforia 0 Answers

AR Camera zoomed in on iPad Air 2 0 Answers

AR Object Button ALMOST FINISHED!!! UNITY/VUFORIA 2 Answers

animated a model with a button in Unity with vuforia 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges