Search Unity

Bug ConfigurableJoint doesn't move straight to targetPosition

Discussion in 'Physics' started by MarekLg, Jun 19, 2022.

  1. MarekLg

    MarekLg

    Joined:
    Jan 31, 2018
    Posts:
    26
    I'm not sure if this is a bug.

    Lets say I have a cube that I want to move to a new targetPosition via a ConfigurableJoint. That new targetPosition is marked by a sphere. The position of the connectedBody is marked by a cross.

    The moment I set the targetPosition, you'd think that the cube moves along the green line towards the sphere, but what actually happens is that it drifts down a bit and comes back up. It always seems to drift a bit in the direction of the connectedBody and suddenly remembers that it actually wants to get to targetPosition.

    How come?

    Screenshot 2022-06-19 173549.png
     
  2. MarekLg

    MarekLg

    Joined:
    Jan 31, 2018
    Posts:
    26
    I've done some experiments that show that the targetPosition may not even be reached. I attached a Package that shows that.
     

    Attached Files:

  3. MarekLg

    MarekLg

    Joined:
    Jan 31, 2018
    Posts:
    26
    And here a screen capture of the problem: TargetPositionBug.gif

    Excerpt from the readme:
     
  4. MarekLg

    MarekLg

    Joined:
    Jan 31, 2018
    Posts:
    26
    It appears that enabling swapBodies works as a workaround and fixes the problem. I don't get why but I take it.