Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

ArticulationBody Hierarchy Resets When Adding a Child Body at Runtime

Discussion in 'Physics Previews' started by KCGames47, Jul 16, 2021.

  1. KCGames47

    KCGames47

    Joined:
    Nov 3, 2014
    Posts:
    39
    Hello,

    Every time I add a new articulation body dynamically as a child to an existing articulation body hierarchy, all bodies in the hierarchy get reset to their initial orientation. E.g. if a closed door is opened during gameplay then I add a new articulation body child to that door during runtime, the door will suddenly close as well as any other body in the hierarchy, they all reset to their initial orientations.

    Is this an expected behavior? and is there any workaround?

    Thanks!
     
  2. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,510
    Sounds like a bug. I'd recommend you to file a bug report with a simple repro case.
     
    KCGames47 likes this.
  3. KCGames47

    KCGames47

    Joined:
    Nov 3, 2014
    Posts:
    39
    Thanks @Edy! I'll do that.

    Also, can someone from Unity let us know if is there a workaround?
     
  4. tjmaul

    tjmaul

    Joined:
    Aug 29, 2018
    Posts:
    467
    You can save the state of the whole tree by traversing all ArticulationBodies and storing jointPositions and jointVelocities. You can write them back after you added the child.

    but I also think this should be considered a bug.
     
    KCGames47 and Edy like this.
  5. KCGames47

    KCGames47

    Joined:
    Nov 3, 2014
    Posts:
    39
    @tjmaul Thank you! storing/applying joint positions and velocities works like a charm!
     
    tjmaul likes this.