Search Unity

Moving / Rotating player has negative effect on orientation of controller

Discussion in 'Daydream' started by Habitablaba, May 14, 2017.

  1. Habitablaba

    Habitablaba

    Joined:
    Aug 5, 2013
    Posts:
    136
    I'm having an issue with the orientation of the daydream controller after moving/rotating the player.

    Basically, I have the player object move forward, turn 90°, and move forward again. When I try to interact with something in front of me, using the daydream controller, I find it's pointing off to the side. In fact, it's pointing at "old" forward still.

    Is there a way to tell the controller to update it's orientation when the player updates orientation? Or am I just doing this wrong and really should find a better way of getting done what I want?

    Thanks for all advice in advance
     
  2. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    Have the controller object as a child of the body. That way when the body rotates so does the controller.
     
  3. Habitablaba

    Habitablaba

    Joined:
    Aug 5, 2013
    Posts:
    136
    Yes I have that, which is why this is perplexing. I think I'm going to just give up trying to figure out why this happens and do it some other way.
     
  4. Habitablaba

    Habitablaba

    Joined:
    Aug 5, 2013
    Posts:
    136
    After fussing around with this for a few days, I've come to the conclusion that the GVRArmModels' FollowGaze property isn't doing what I expect it to.

    First of all, if I throw in a few debug log lines, I can see that it isn't finding the main camera as written. If I replace the call to Camera.main with a FindWithTag("MainCamera").GetComponent<Camera>() it finds it fine.
    Second, and really most importantly, it just simply isn't updating the orientation when the gaze moves. If I stand still, I can interact with something in front of me. If I turn to the side, I'm still interacting with whatever was in front of me. It seems to me that if the follow gaze property is set to "always" then this isn't how it should happen?
     
  5. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    Can't say I've ever done it that way. GVRController and GVRArmModel are required for their API to return you values but after that I've always just queried the GVRController's position and updated the transform I have representing the model of the controller. As long as you have some hierarchy so that the hand is a child of the body and you update the local position things seem fine.

    I'm sure there is a way to do it with all their prefabs but I've always just bypassed them and gone straight to the controller. Maybe someone else can chime in with how to do it with Google's components.