小编ray*_*ray的帖子

unity3d中的陀螺仪有什么问题(在google nexus 7上测试)

我在c#中编写了一个脚本来测试unity3d 4.0中的陀螺仪.并得到信息打击: 在此输入图像描述

然而,我旋转或移动我的谷歌nexus 7.每个参数保持"0"; 我不知道为什么.

有人可以帮帮我吗?

这是我的代码:

using UnityEngine;
using System.Collections;

public class gyroscope : MonoBehaviour
{
    private Gyroscope gyo1;
    private bool gyoBool;
    //private Quaternion rotFix;

    // Use this for initialization
    void Start ()
    {
        gyoBool = SystemInfo.supportsGyroscope;
        Debug.Log (gyoBool.ToString ());
    }

    // Update is called once per frame
    void Update ()
    {
    gyo1=Input.gyro;

    }

    void OnGUI ()
    {
        if (gyoBool != null) 
        {
            GUI.Label (new Rect (10, Screen.height / 2 - 50, 100, 100), gyoBool.ToString ());
            if (gyoBool == …
Run Code Online (Sandbox Code Playgroud)

c# unity-game-engine gyroscope

3
推荐指数
1
解决办法
7193
查看次数

标签 统计

c# ×1

gyroscope ×1

unity-game-engine ×1