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

allows users to view 360º content without a VR headset

Discussion in 'VR' started by unity_eaKm_7FNf4Uaww, Jun 13, 2019.

  1. unity_eaKm_7FNf4Uaww

    unity_eaKm_7FNf4Uaww

    Joined:
    Mar 14, 2019
    Posts:
    6
    Allows users to view 360º content without a VR headset.
    I have read the article and used the script from the below link.
    https://developers.google.com/vr/develop/unity/guides/magic-window?authuser=1

    this is working perfectly fine. check this code:
    transform.localRotation =
    // Allow user to drag left/right to adjust direction they're facing.
    Quaternion.Euler (0f, -dragYawDegrees, 0f) *

    // Neutral position is phone held upright, not flat on a table.
    Quaternion.Euler (90f, 0f, 0f) *

    // Sensor reading, assuming default `Input.compensateSensors == true`.
    Input.gyro.attitude *

    // So image is not upside down.
    Quaternion.Euler (0f, 0f, 180f);

    which helps in dragging left/right. But I also want to swipe upward/downward. Does anyone have idea how can I do this using the script available in the above link?
     
  2. FMark92

    FMark92

    Joined:
    May 18, 2017
    Posts:
    1,244
    What does?
     
  3. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    8,853
    i'd guess need to add
    dragPitchDegrees += touch.deltaPosition.y * DRAG_RATE;
    and then use it in the localRotation = ...