Odd HingeJoint2D Behaviour with limits.

I have experienced every odd hinge joint behaviour when using limits. It seems to “jump” while rotating.

I figured it is easier to see than to describe so there is a gif below. The expected outcome is the white part rotating “smoothly” with the grey cube.

The fast rotation change/jump is no recording artefact. This is what’s happening in the editor. It always jumps once the joint comes “down” on the left. I have slowed it down on the second turn to make it easier to see. It seems to rotate clockwise backwards to the limit. That’s what puzzles me because I would expect it to keep rotating counter clockwise with the cube which drives it.

The setup is very simple: one static rigidbody (the grey cube) which gets rotated via script (Transform.Rotate(…)). One Hinge attached to it with some limits (the white “limb”).

This is all the code used:

using UnityEngine;

public class RotationRoot : MonoBehaviour
{
    [Range(-2f,2f)]
    public float RotationSpeed = 0.2f;

    private void FixedUpdate()
    {
        float angle = Time.fixedDeltaTime * 180 * RotationSpeed;
        this.transform.Rotate(new Vector3(0, 0, 1), angle);
        Physics2D.SyncTransforms();
    }
}

In my project the hinge is in a more complex setup (not driven by a static rigidbody) but I have been able to reduce it to this repro case. Tested on Unity 2019.4.1f1 and Unity 2019.4.2f1.

Has anyone encountered this before? Is it a “bug”?
Thank you

Some more intel.

If rotated with another hinge + motor on the “rotation root” or RigidBody.MoveRotation(…) it work just fine. I therefore assume it was never meant to be used with a static rigidbody + transform rotation. Still wonder why it’s working “half” the time though.