Version: 2017.3

Input.acceleration

Cambiar al Manual
public static Vector3 acceleration ;

Descripción

Última aceleración lineal medida de un dispositivo en el espacio tridimensional. (Read Only)

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public float speed = 10.0F; void Update() { Vector3 dir = Vector3.zero; dir.x = -Input.acceleration.y; dir.z = Input.acceleration.x; if (dir.sqrMagnitude > 1) dir.Normalize(); dir *= Time.deltaTime; transform.Translate(dir * speed); } }