返回介绍

Compass.rawVector 原始向量

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

JavaScript => public var rawVector: Vector3;
C# =>public Vector3 rawVector;

Description 描述

The raw geomagnetic data measured in microteslas. (Read Only)
原始地磁数据,单位微特斯拉。(只读)

The compass is actually a magnetometer that measures the magnetic field in the device's XYZ coordinates - in the absence of a stronger magnet, it will measure the Earth's field from which the compass heading can be found. This property can be used if you want to make non-standard use of the compass (eg, find the heading from the X or Z axis of the device).
指南针实际上是在设备的XYZ坐标上测量磁场的磁力仪,当没有强大的磁力时,它将以指南针航向发现的地球磁场计算。如果你想使用非标准的指南针,可以使用这个属性(例如,找到这个设备的X或Z轴航向)。

JavaScript:

function OnGUI() {
		GUILayout.Label("Magnetometer reading: " + Input.compass.rawVector.ToString());
	}

C#:

using UnityEngine;
using System.Collections;
 
public class ExampleClass : MonoBehaviour {
    void OnGUI() {
        GUILayout.Label("Magnetometer reading: " + Input.compass.rawVector.ToString());
    }
}

compass

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

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

发布评论

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