返回介绍

Compass.magneticHeading 磁航向

发布于 2019-12-18 15:37:35 字数 1171 浏览 1080 评论 0 收藏 0

JavaScript => public var magneticHeading: float;
C# =>public float magneticHeading;

Description 描述

The heading in degrees relative to the magnetic North Pole. (Read Only)
相对于磁北极的航向,单位度。(只读)

The value in this property is always measured relative to the top of the screen in its current orientation. The heading of magnetic north is not exactly the same as true geographical north - to get the exact heading, use the trueHeading property.
在当前的方向,该属性值总是相对于屏幕顶端。磁北的航向并不是与真正的地理的磁北极一样——要得到精确的航向,使用trueHeading属性。

JavaScript:

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

C#:

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

compass

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文