Search Unity

Question XR Origin children not following parent object.

Discussion in 'VR' started by doingTheCodes, Jan 8, 2023.

  1. doingTheCodes

    doingTheCodes

    Joined:
    Apr 27, 2016
    Posts:
    19
    I read Read this: https://docs.unity3d.com/Manual/PositioningGameObjects.html
    Didn't help.

    I'm in a scene and I want the player to start at a particular point. I notice when I move the XR Origin gameObject around eventually (Cam offset and children, camera) starts to drift away from the gameObject gizmo. The controllers remain statically in place no matter what.

    When I loaded up the scene for testing the controllers which were still sitting on 0,0,0 weren't visible to me as they should be.

    How do you make the XR rig actually follows the XR Origin game object so you can move your starting location in the scene around? What am I not understanding about how this is set up.
     

    Attached Files:

  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,043
    1. First get the hmd tracked the way you want, then fix the hands
    2. Can you make a video of the drifting? Not sure what you mean here. Are you using center or pivot with the transform toolm
     
  3. doingTheCodes

    doingTheCodes

    Joined:
    Apr 27, 2016
    Posts:
    19
    The hmd is where I want it. I'm using center with the transform tool. I could make a video but I'm not sure exactly how todo that so I'd have to figure it out.

    Say I have a very large scene like in the picture I posted. When I go to move the XR Origin object I expect the camera offset and its children to follow with it because that's what I see happen with all other children objects in parent objects. When I select the camera offset object it's like hundreds of units away from the XR origin, even when the position of the camera offset is 0,0,0. Does that make sense?
     
  4. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,043
    For the transform tool use pivot to see where the object is in the scene view.
    I get what you mean now. The camera and controllers tracked pose drivers will be relative to their parent object, so those staying around the offset is correct.
    Why the offset stays at 0, I don't know. How is your VR player and it's locomotion setup? Does it also happen if you disable this one and insert a new player?
     
  5. doingTheCodes

    doingTheCodes

    Joined:
    Apr 27, 2016
    Posts:
    19
    I went to a new scene. The controllers don't show up at all in the scene. I think this is one of the same problems I was having in the other scene as well. No idea how I screwed this up so badly. upload_2023-1-8_12-24-46.png
     
  6. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,043
    Is it just the hands?
    If not, focus on the hmd working properly first
     
  7. doingTheCodes

    doingTheCodes

    Joined:
    Apr 27, 2016
    Posts:
    19
    Yeah it's just the hands not showing up. I haven't had any issue with the hmd in terms of it working or giving me a display into the game, but the controllers aren't showing up in these scenes.
     
  8. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,043
    So the drifting issue is fixed?

    If so, is the tracked pose driver on the controller or child?
     
  9. doingTheCodes

    doingTheCodes

    Joined:
    Apr 27, 2016
    Posts:
    19
    Okay so after Doing a few things I got the controllers working. had to restart my machine and make sure all of the actions were mapped properly according to reference in their controller scripts.
    upload_2023-1-8_13-47-7.png
    upload_2023-1-8_13-47-27.png
    upload_2023-1-8_13-47-48.png

    So here is 3 images where x starts at 0, then increases and the camera gizmo just starts to run ahead of it for some reason. It's truly bizzare.
     
  10. doingTheCodes

    doingTheCodes

    Joined:
    Apr 27, 2016
    Posts:
    19
    Okay! I figured it out.

    In edit mode the controllers don't move. The camera offset was set to Center, not Pivot. This made the calculated gizmo BETWEEN the cameraOffset gameObject and it's children ( the controllers ). So as I moved the XR Origin gO along the X axis the controllers were creating an average (x) that was less than the XR Origin game object. This meant when the cameraOffset [Tool Hand Position] is set to Center it was averaging it all and making it seem like it was 'drifting away'

    Thanks so much for your help and patience @DevDunk!

    For people that find this thread. In this picture is the circle UI spot to change the setting and another line marker indicating where the controller scene object is and an x marking the "Center" calculated position when the Tool Hand Position is set to center.
    upload_2023-1-8_13-58-10.png
     
    simonpham1294, DevronDJ and DevDunk like this.
  11. DevronDJ

    DevronDJ

    Joined:
    Sep 8, 2022
    Posts:
    3
    You are awesome, thank you :) Been stuck with this for a while
     
  12. simonpham1294

    simonpham1294

    Joined:
    Jun 7, 2023
    Posts:
    4
    Thanks, this has helped me.