我想得到一些指导,而不是解决问题的方法,因为我试图学习,正如他们所说,学得很好,它永远不会忘记。
我正在尝试在Unity内置的AR应用程序中使用锚点。
摘要:
让我们想象一下,自应用程序开始以来,我需要使用Real Coordinates生成一些对象(为此,我使用的是Google Maps SDK for Unity),问题是我生成的所有对象都在不断漂移从其原始位置开始,这就是为什么我要使用锚点的原因。
我已阅读此文档:
https://developers.google.com/ar/develop/developer-guides/anchors
如您所见,在一行中显示了一行:“选择锚点上下文。使用Trackable或ARCore会话将锚点添加到场景中。” (我有兴趣使用ARCore会话来创建我的锚点,我没有使用飞机,因此对于我而言,可追踪性不是一个好方法。)
然后,我已阅读此文档:
https://developers.google.com/ar/reference/unity/class/GoogleARCore/Anchor
我对在ARCore会话中使用锚点一无所知,仅在Trackables上使用,所以我有点迷失了。
任何人都知道如何实现我的想法吗?
该应用必须显示现实世界中的对象,例如有线电缆,输水管道等。
致谢。
迭戈。
答案 0 :(得分:0)
我想我明白了,希望这个答案对其他人有帮助
public void Spawner1()
{
Vector3 position = new Vector3(1, 0, 1);
Quaternion rotation = new Quaternion(0f, 0f, 0f, 0f);
Pose pose = new Pose(position, rotation);
var normalPrefabAnchor = Instantiate(NormalPrefab, position, rotation);
var anchor = Session.CreateAnchor(pose);
normalPrefabAnchor.transform.parent = anchor.transform;
}