Search Unity

How To Align GvrController.Qrientation With Camera.Forward

Discussion in 'Daydream' started by poopoo145, Oct 14, 2016.

  1. poopoo145

    poopoo145

    Joined:
    Oct 25, 2015
    Posts:
    2
    Hi,

    How can I make sure the controller points in the right direction if the camera gets rotated?

    I tried this: Vector3 rayDirection = GvrController.Orientation * cameraTransform.forward;
    It manages to get the orientation correct when the controller is at its start rotation, however, when I rotate the controller the axises get messed up or even switched if the camera to not facing the default rotation (0, 0, 0)

    Any help will be appreciated!
     
  2. BWerner

    BWerner

    Joined:
    Sep 23, 2016
    Posts:
    13
    I'm glad you are asking about controller orientation. Unfortunately I do not have a solution, only observations.

    I've been working on this as well and noticed different approaches.
    -The first while in Playground, the Boomerang game specifically, when you press the home button the controllers forward orientation becomes the same as the camera.
    -The second in my own game development within Unity editor using SDK 1.01 and Technical Preview 5.4.1f GVR 8, the home button brings the camera back to (0,0,0).

    BOTH of these behaviors work ONLY in the editor. The App button is available in the Controller API, nut no the Home button and I was wondering why as well. The bool's Recentering and Recentered are listed in the API class reference. Hope we can get some answers on recentering and orientation soon.
     
  3. mira_leung

    mira_leung

    Official Google Employee

    Joined:
    May 17, 2016
    Posts:
    70
    The intended behaviour for long-pressing on the Home button is to recenter the headset, i.e. InputTracking.Recenter().

    BWerner@, could you please describe on what behaviour you are seeing when recentering on the device, as well as the device type and Android build number?

    poopoo145@, could you please provide a sample project for repro, or elaborate on repro steps?