Configurable Joint causes physics 'pop'

Hi, based on mouse input from the user, I’m tilting a parent object around its X and Z axis. This object has a child object attached to it (see diagram). As the parent object tilts, I’m ascertaining the greatest axis that it’s moved (so it’s X or Z). Based on this, I’m restricting the axis the child object can move by using configurable joints. So the child object can never move diagonally, only left/right or up/down. This is the code I’m using in FIXEDUPDATE

        tiltVector = Iceberg.ReturnTilt();

        if (Mathf.Abs(tiltVector.x) >= Mathf.Abs(tiltVector.z))
        {
            print("Locking Z Motion");
            referenceToJoint.zMotion = ConfigurableJointMotion.Locked;
            referenceToJoint.xMotion = ConfigurableJointMotion.Free;

        }
        else
        {
            print("Locking X Motion");
            referenceToJoint.xMotion = ConfigurableJointMotion.Locked;
            referenceToJoint.zMotion = ConfigurableJointMotion.Free;
        }

The issue I’m having is the code above - sometimes when it enters the code within the ‘if’ statement and locks one axis while freeing another, the object ‘pops’ up vertically.

Any reasons why?

Thanks in advance for any help

474702--16681--$Untitled.jpg

actually - it’s not just popping up - it’s rotation, spinning, then somehow return to roughly the point it began to act crazy anytime if tries to execute the code that frees one axis but lock the other.

…anyone experienced this…?

Just an update - if I remove the code after the else statement (so it’s only locked in one axis), all the physics stabilise and it works perfectly (aside from the ability to locking it to the z axis obviously!).

So, the problem is definately occuring when I free one axis (after its locked) and lock one axis (after it’s free).