I’m a not really new to Unity but I can’t get my 2D pendulum working.
I have made a gameobject with a Rigidbody 2D, and fixed points (x,y),
and rotated it by 320°. Then I added a child object, a Rigidbody 2D component.
But I can’t figure out how to do this.
I have tried the Distance joint but that doesn’t work for me, because when I lift it, it moves weirdly.
(Sorry for my English, its not my native language.)
A DistanceJoint2D should work fine but I guess it depends on what you mean by ‘when I lift it, it moves weirdly’. As always, you should never move Rigidbody2D by modifying the transform.
The DistanceJoint2D can stretch but to counter this, trying adding two DistanceJoint2D configured the same however on the second one, select ‘Max Distance Only’.
You can see this being used in Box2Ds test-bed.