- Home /
How to make a 2D pendulum?
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.)
Answer by MelvMay · Jul 23, 2015 at 02:02 PM
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.
Your answer
Follow this Question
Related Questions
Raycast2D hits itslf 2 Answers
Physics2D.Raycast.collider is always returning an object? 4 Answers
Transform.translate bullets problem 0 Answers
Custom 2D physics of a rope (top-down view) 1 Answer
Animate projectile before throwing? 1 Answer