跟踪丢失后如何保持跟踪的Image Target模型对象? [英] How to keep tracked Image Target model object after tracking lost?

查看:110
本文介绍了跟踪丢失后如何保持跟踪的Image Target模型对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Unity3d和Vuforia开发AR应用程序.我想保留当丢失时跟踪找到的ImageTarget对象.跟踪丢失后如何保持跟踪的Image Target模型对象?

I am developing AR application with Unity3d and Vuforia. I want to keep ImageTarget object that tracked found when It was lost. How to keep tracked Image Target model object after tracking lost?

推荐答案

处理丢失跟踪时发生的情况的脚本称为DefaultTrackableEventHandler.cs,可在Assets> Vuforia>脚本中找到.在该文件中,您将找到函数OnTrackingLost().此函数为ImageTarget的每个子级禁用所有的renderComponentscolliderComponents.如果您希望对象保持可见,请注释掉以下foreach循环,如下所示:

The script that handles what happens when tracking is lost is called DefaultTrackableEventHandler.cs and is found in Assets > Vuforia > Scripts. In that file you will find a function OnTrackingLost() This function disables all the renderComponents and colliderComponents for each of the children of the ImageTarget. If you want your object to stay visible comment out the following foreach loops like so:

private void OnTrackingLost()
{
    Renderer[] rendererComponents = GetComponentsInChildren<Renderer>(true);
    Collider[] colliderComponents = GetComponentsInChildren<Collider>(true);

    /*
    // Disable rendering:
    foreach (Renderer component in rendererComponents)
    {
        component.enabled = false;
    }

    // Disable colliders:
    foreach (Collider component in colliderComponents)
    {
        component.enabled = false;
    }
    */

    Debug.Log("Trackable " + mTrackableBehaviour.TrackableName + " lost");
}

这篇关于跟踪丢失后如何保持跟踪的Image Target模型对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆