Log in or register to post comments

What does the 'Turn Off Behaviour' script do?

November 16, 2017 - 1:14pm #1

Hi

I'm trying to strip down the Image Target prefab to what I need in my project.

What does the Turn Off Behaviour script do? I cant find any documentation for it.

Thanks

What does the 'Turn Off Behaviour' script do?

November 24, 2017 - 9:35am #6

Thanks very much Strasza, its really useful to have.

 

 

What does the 'Turn Off Behaviour' script do?

November 21, 2017 - 11:47am #5

Hey Jim,

Sorry for the delayed response here, I was making sure it was okay to share the source for this. The source is the following:

/*==============================================================================
Copyright (c) 2010-2014 Qualcomm Connected Experiences, Inc.
All Rights Reserved.
Confidential and Proprietary - Protected under copyright and other laws.
==============================================================================*/

using UnityEngine;

namespace Vuforia
{
    /// <summary>
    /// A utility behaviour to disable rendering of a game object at run time.
    /// </summary>
    public class TurnOffBehaviour : TurnOffAbstractBehaviour
    {

        #region UNITY_MONOBEHAVIOUR_METHODS

        void Awake()
        {
            if (VuforiaRuntimeUtilities.IsVuforiaEnabled())
            {
                // We remove the mesh components at run-time only, but keep them for
                // visualization when running in the editor:
                MeshRenderer targetMeshRenderer = this.GetComponent<MeshRenderer>();
                Destroy(targetMeshRenderer);
                MeshFilter targetMesh = this.GetComponent<MeshFilter>();
                Destroy(targetMesh);
            }
        }

        #endregion // UNITY_MONOBEHAVIOUR_METHODS

    }
}

The reasoning behind this script is to remove the Image Target texture from the scene. This is shown in the Unity scene when the app isn't running as a visual aid so you can more easily set up how your augmentation will look in relation to the target, but when you actually run the app you don't want to render this as it is ultimately a representation of the target in the real world that you'll be detecting with your camera to augment.

Let me know if you have any additional questions about this.

Thanks,

-Vuforia Support

What does the 'Turn Off Behaviour' script do?

November 21, 2017 - 12:44am #4

@Strasza Would it be possible to get the source for this script?

What does the 'Turn Off Behaviour' script do?

November 17, 2017 - 12:37am #3

HI Strasza

 

Thanks so much for the reply.

 

Would it be possible to get the source in this instance? I imagine its fairly simple to recreate in my custom handler script but would like to make sure I'm not missing anything.

And so I'm clear about the reasoning behind having this functionality. Is it for performance reasons and so that its not visible when viewing other game objects using image targets?

 

Thanks again

 

Jim

 

 

What does the 'Turn Off Behaviour' script do?

November 16, 2017 - 4:21pm #2

Hello JimJamesJimJim

This script will disable the Image Target's renderer so that the image won't be rendered in the Unity scene.

Thanks,

-Vuforia Support

Log in or register to post comments