Unity中的ARCore扩展ImageTracking/锚定API [英] ARCore Extended ImageTracking / Anchoring API in Unity
问题描述
Unity SDK软件包随附的ARCore AugmentedImage示例应用程序在示例AugmentedImageDatabase中包含的示例图像周围放置了一个相框.如果找到,它将在场景中的多个图像周围放置一个相框,并且仅在完全失去跟踪后才销毁这些相框.
假设您只想在最近识别的图像周围显示相框-并从上一张图像中删除该相框?检查给定图像的TrackingState没有帮助,因为默认情况下跟踪已扩展且没有任何关闭方式,并且锚定API也没有提供任何有帮助的信息.
一旦包含可跟踪图像的列表超过1,我就通过销毁旧会话(并创建一个新会话)来工作,但这导致该应用暂时冻结一秒钟,然后再继续.
是否有更好的建议?
考虑到对此github 我构建了它,这样您就可以返回以前跟踪的图像,如果您对3秒钟的时间不满意,也可以降低它.祝你好运 The ARCore AugmentedImage example application that comes with the Unity SDK package places a picture frame around the sample images included in the sample AugmentedImageDatabase. It will place a picture frame around multiple images in the scene if they are found, and only destroy the picture frames once tracking is lost entirely. Suppose you wanted to only display a picture frame around the image most recently recognized - and remove the frame from the previous image? Checking the TrackingState of a given image doesn't help since the tracking is extended by default without any way to turn off, and the anchor API doesn't offer any information that would help either. I have it working by destroying the old session (and creating a new one) once the list that holds the Trackable images exceeds 1, but that leads to the app temporarily freezing up for a second before resuming. Are there suggestions on a better way to do this? Okay this is not an exact solution considering the reply to this github issue from Google developers but it solves the issue. As i said in my comments Since there is no way of knowing when image is updated and it is not happening frequently, i thought of checking if image is not updated for 3 seconds i can destroy the image. In order to do so, i added I built it and this way you can go back to images which are tracked before and if you are not happy about 3 seconds you can lower it as well. Good luck 这篇关于Unity中的ARCore扩展ImageTracking/锚定API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!TrackableQueryFilter.Updated
gives you images that are updated(not just in terms of status but position etc.) in the current frame. Therefore, when i log the m_TempAugmentedImages.Count
for 318 frames while my image is in the view of my phone and being tracked, my image is updated 18 times. public float TimePassed
to my AugmentedImageVisualizer
script. Then in my AugmentedImageController
script i added these lines to check TimePassed
of every image that is in the Session like this: foreach (var visualizer in m_Visualizers.Values)
{
// if image is Updated TimePassed is assigned to zero for that image
if (m_TempAugmentedImages.Count != 0 && visualizer.Image == m_TempAugmentedImages[0])
{
visualizer.TimePassed = 0;
}
else
{
visualizer.TimePassed += Time.deltaTime;
}
if (visualizer.TimePassed > 3.0f)
{
Debug.Log("Destroy is called");
m_Visualizers.Remove(visualizer.Image.DatabaseIndex);
GameObject.Destroy(visualizer.gameObject);
}
}