Attaching Local Avatar to Player Controller in Unity — Oculus
Welcome to the Oculus Developer Forums!

Your participation on the forum is subject to the Oculus Code of Conduct.

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums may be revoked at the discretion of Oculus staff.

Attaching Local Avatar to Player Controller in Unity

I have a problem attaching the avatar prefab for touch controls to the player controller prefab from oculus SDK. I have tried making both prefabs as children of an empty parent object. I tried to make the local avatar a child of player controller and it works fine until I move and my hands stay in the same spot while the body moves. I tried looking for a solution and cannot find one. Is there another way of doing this?


Thank you.

Comments

  • Stas054Stas054 Posts: 2
    NerveGear
    Thank you.
  • wynottwynott Posts: 7
    NerveGear
    I'm having the same issue.

    If I take an empty scene with a ground plane, add the OVRPlayerController and the LocalAvatar... And try and make the LocalAvatar a child of the OVRPlayerController the registration gets all messed up between them. Hands are wildly out of place, look direction affects their position etc.
  • wynottwynott Posts: 7
    NerveGear
    And yes, I'm looking to have avatar hands and controllers moving around the scene with the player.
  • wynottwynott Posts: 7
    NerveGear
    OK @Stas054 I got this to work by making LocalAvatar a child of OVRPlayerController.

    In inspector in OVRPlayerController there's two boxes HMD Resets Y and HMD Rotates Y. I unchecked both.

    I also had to set the LocalAvatar 0.5m above the OVRPlayerController insert point.

    No idea why 0.5m but... Seems to have worked.
  • Alpha14Alpha14 Posts: 3
    NerveGear
    edited March 2017
    To elaborate on Wynotts post the fix is as follows and works flawlessly.

    STEP 1 - You must drop the Local Avatar prefab in the child of "TrackingSpace" Not the just the OVRPlayerController. If you do not do this correctly it will not work at all.
    STEP 2 - Click on OVRPlayerController and goto inspector. Untick on "Hmd Resets Y"
    STEP 3 - Make sure "Hmd Rotates Y" is ticked

    ADMINS - Please mark resolved.
  • Alpha14Alpha14 Posts: 3
    NerveGear
    TO update
    wynott said:
    OK @Stas054 I got this to work by making LocalAvatar a child of OVRPlayerController.

    In inspector in OVRPlayerController there's two boxes HMD Resets Y and HMD Rotates Y. I unchecked both.

    I also had to set the LocalAvatar 0.5m above the OVRPlayerController insert point.

    No idea why 0.5m but... Seems to have worked.

    Alpha14 said:
    To elaborate on Wynotts post the fix is as follows and works flawlessly.

    STEP 1 - You must drop the Local Avatar prefab in the child of "TrackingSpace" Not the just the OVRPlayerController. If you do not do this correctly it will not work at all.
    STEP 2 - Click on OVRPlayerController and goto inspector. Untick on "Hmd Resets Y"
    STEP 3 - Make sure "Hmd Rotates Y" is ticked

    ADMINS - Please mark resolved.

  • Alpha14Alpha14 Posts: 3
    NerveGear
    Spoke a little soon, works great in Unity dev mode. However if I export a build there is no avatar at all and can see a purple head stuck in the floor. Any ideas? What did I miss.
  • gianniamericangianniamerican Posts: 2
    NerveGear
    Alpha14 said:
    To elaborate on Wynotts post the fix is as follows and works flawlessly.

    STEP 1 - You must drop the Local Avatar prefab in the child of "TrackingSpace" Not the just the OVRPlayerController. If you do not do this correctly it will not work at all.
    STEP 2 - Click on OVRPlayerController and goto inspector. Untick on "Hmd Resets Y"
    STEP 3 - Make sure "Hmd Rotates Y" is ticked

    ADMINS - Please mark resolved.

    I got it to work with this fix, but without unticking "Hmd Resets Y"
  • alejonce8alejonce8 Posts: 2
    NerveGear
    Alpha14 said:
    Spoke a little soon, works great in Unity dev mode. However if I export a build there is no avatar at all and can see a purple head stuck in the floor. Any ideas? What did I miss.
    I'm having a similar issue. While I'm working on the project, the LocalAvatar hands work great, but if I build and run the hands' mesh is nowhere to be seen. The joystick and buttons still work but the hands can't be seen. If I open the oculus menu, you can see the hands there but not in my build. Anybody has any solution for this?
  • xStarshadowxStarshadow Posts: 3
    NerveGear
    Thank you Alpha14!!! I am so very grateful! This helped me out tremendously. I would also like to note, as with gianniamerican, simply putting it as child of TrackingSpace was sufficient for me as well. :)
  • OndeTvOndeTv Posts: 6
    NerveGear
    alejonce8 said:
    Alpha14 said:
    Spoke a little soon, works great in Unity dev mode. However if I export a build there is no avatar at all and can see a purple head stuck in the floor. Any ideas? What did I miss.
    I'm having a similar issue. While I'm working on the project, the LocalAvatar hands work great, but if I build and run the hands' mesh is nowhere to be seen. The joystick and buttons still work but the hands can't be seen. If I open the oculus menu, you can see the hands there but not in my build. Anybody has any solution for this?
    Although this is an old post, i recently had the same issue with the controller+avatar. However, the purple hands/body/etc is most likely a shader reference issue. I just had this upgrading to unity 2018.1.
  • tkdHayktkdHayk Posts: 31 Oculus Start Member
    yeOndeTv said:
    alejonce8 said:
    Alpha14 said:
    Spoke a little soon, works great in Unity dev mode. However if I export a build there is no avatar at all and can see a purple head stuck in the floor. Any ideas? What did I miss.
    I'm having a similar issue. While I'm working on the project, the LocalAvatar hands work great, but if I build and run the hands' mesh is nowhere to be seen. The joystick and buttons still work but the hands can't be seen. If I open the oculus menu, you can see the hands there but not in my build. Anybody has any solution for this?
    Although this is an old post, i recently had the same issue with the controller+avatar. However, the purple hands/body/etc is most likely a shader reference issue. I just had this upgrading to unity 2018.1.
    Yes, and it can be fixed by manually transferring the old shader and  shader meta data to the new project. 
  • tkdHayktkdHayk Posts: 31 Oculus Start Member
    yeOndeTv said:
    alejonce8 said:
    Alpha14 said:
    Spoke a little soon, works great in Unity dev mode. However if I export a build there is no avatar at all and can see a purple head stuck in the floor. Any ideas? What did I miss.
    I'm having a similar issue. While I'm working on the project, the LocalAvatar hands work great, but if I build and run the hands' mesh is nowhere to be seen. The joystick and buttons still work but the hands can't be seen. If I open the oculus menu, you can see the hands there but not in my build. Anybody has any solution for this?
    Although this is an old post, i recently had the same issue with the controller+avatar. However, the purple hands/body/etc is most likely a shader reference issue. I just had this upgrading to unity 2018.1.
    Yes, and it can be fixed by manually transferring the old shader and  shader meta data to the new project. 
Sign In or Register to comment.