gpt4 book ai didi

android - ARCore+Unity3D : How to make a scene oriented to north?

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:07:04 27 4
gpt4 key购买 nike

我一直在 Unity 中使用 ARCore。

我想要实现的是根据输入的 GPS 坐标和当前 GPS 位置生成对象(例如,对象应该在 x.xxxxx、y.yyyyy 坐标处生成,这些坐标在 Unity 中转换为世界坐标)。

我发现为了正确放置物体,我需要以某种方式保持北向。

ARCore 怎么可能?在 ARKit 中,创建场景时其中一个轴朝北(根据场景创建时的罗盘读数)。 ARCore 不是这种情况。

ARCore 有解决方法吗?

最佳答案

在Unity文档中找到了答案:

https://docs.unity3d.com/ScriptReference/Compass-magneticHeading.html

function Update () {
// Orient an object to point to magnetic north.
transform.rotation = Quaternion.Euler(0, -Input.compass.magneticHeading, 0);
}

关于android - ARCore+Unity3D : How to make a scene oriented to north?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46602420/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com