简体   繁体   English

如何从检测到的 ObjectInstance 中获取位置?

[英]How do I get a position from a detected ObjectInstance?

I have been trying to follow what's in https://docs.microsoft.com/en-us/azure/object-anchors/concepts/sdk-overview with some success.我一直在尝试遵循https://docs.microsoft.com/en-us/azure/object-anchors/concepts/sdk-overview中的内容并取得了一些成功。 I successfully detect an ObjectInstance, but how do I get the coordinates to place my GameObject in the matching position?我成功地检测到了一个 ObjectInstance,但是如何获得将我的 GameObject 放置在匹配位置的坐标? There are a lot of unfamiliar concepts to me in the documentation like SpatialGraphCoordinateSystem and I am at a loss on how to take it further.在 SpatialGraphCoordinateSystem 等文档中,我有很多不熟悉的概念,我不知道如何更进一步。

In reading your question above, I think based on what you are asking, you are needing to call this: ObjectInstance.TryGetCurrentState Method (Microsoft.Azure.ObjectAnchors) |在阅读您上面的问题时,我认为根据您的要求,您需要调用它: ObjectInstance.TryGetCurrentState Method (Microsoft.Azure.ObjectAnchors) | Microsoft Docs 微软文档

This will return an ObjectInstanceState with a center property that is a SpatialGraphLocation Struct (Microsoft.Azure.ObjectAnchors.SpatialGraph) |这将返回一个 ObjectInstanceState,其中心属性是SpatialGraphLocation 结构 (Microsoft.Azure.ObjectAnchors.SpatialGraph) | Microsoft Docs 微软文档

The SpatialGraphLocation will have the pose information that you are looking for. SpatialGraphLocation 将包含您正在寻找的姿势信息。

If you have questions on Coordinate Systems in general in Mixed Reality, I'd suggest you start here to learn more: Coordinate systems - Mixed Reality如果您对混合现实中的一般坐标系有疑问,我建议您从这里开始了解更多信息: 坐标系 - 混合现实

Another good resources on AOA, if you haven't looked at the sample already, is available here: https://github.com/Azure/azure-object-anchors关于 AOA 的另一个好资源,如果您还没有看过示例,可以在这里找到: https ://github.com/Azure/azure-object-anchors

There is also a tutorial that walks through this sample here: Quickstart: In-depth MRTK walkthrough - Azure Object Anchors |此处还有一个介绍此示例的教程: 快速入门:深入 MRTK 演练 - Azure 对象锚 | Microsoft Docs 微软文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM