Version: 2017.1
public Vector3 gravity ;

描述

返回以设备参考系表示的重力加速度矢量。

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public float movementScale; void Update() { Vector3 pos = transform.position; pos.y = Vector3.Dot(Input.gyro.gravity, Vector3.up) * movementScale; transform.position = pos; } }