Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

how to use gyroscope user acceleration

Discussion in 'Android' started by frank45, Jun 3, 2014.

  1. frank45

    frank45

    Joined:
    Apr 23, 2012
    Posts:
    26
    hi,

    I am trying to use gyroscope of the android device but unable to use the features through unity script.What could be the possible solution.

    Here is the script..!!

    void Update() {

    Debug.Log ("gyro=" + Input.gyro.enabled);
    Debug.Log ("useraccrl=" + Input.gyro.userAcceleration.normalized);

    }

    And the result is:

    gyro=False
    useraccrl=(0.0, 0.0, 0.0)

    Though i have gyroscope and accelerometer in my mobile phone.!!

    Thanks.
     
  2. Agent_007

    Agent_007

    Joined:
    Dec 18, 2011
    Posts:
    899
  3. vivalavida

    vivalavida

    Joined:
    Feb 26, 2014
    Posts:
    85
    have you enabled the gyro?

    in start add the line

    Input.gyro.enabled = true;