Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

InputSystem XR and child gameobject offsets

Discussion in 'Animation Rigging' started by jasonatkaruna, Oct 29, 2019.

  1. jasonatkaruna


    Feb 26, 2019
    I'm trying to set up an XR-driven IK rig for my avatar. In my scene I have a playspace with an HMD, Left Controller, and Right Controller as my tracked nodes. These track perfectly fine, and I'm able to use them directly as targets for my IK Rig on my avatar using the new Animation Rigging Constraints. The problem I'm having comes about when I try to set the targets to child gameobjects under the nodes.

    I have a Head Target, Right Hand Target, and Left Hand Target as child gameobjects beneath the HMD, Right Controller, and Left Controller respectively. I'm using these child gameobjects as offsets to line up the avatar's hands and head with the user's hands and head. When I run the scene, the hands and head of the avatar are frozen in the starting position of the offset gameobjects. I'm not sure why the Chain IK and Two Bone IK constraints would work for the tracked nodes, but not the children beneath them. When I turn off the tracked pose and move the targets manually in the scene view, the avatar's hands and head follow correctly.

    Here's a screenshot of my Head IK setup:

    The hierarchy:

    The hmd node:
  2. simonbz


    Unity Technologies

    Sep 28, 2015

    I think the problem here is that the "Head", the "Right Hand" and the "Left Hand" game object are not evaluated in the animation stream. I don't know exactly how you freeze the position of these game objects, but it's possible that the initial position has been snapshot in the Animation Rigging stream instead of the offset you set afterwards...

    For performance reasons, we do not add game objects properties in the animation stream unless they are animated, or unless Animation Rigging has identified it as a constraint dependency (read or write).

    You can add a RigTransform component to the intermediate objects in your rig to get changes to the GameObject properties to be considered.
    jasonatkaruna likes this.