How can I create 2D swinging ball?

Hello, everybody.

I am developing a 2D platformer game and I am currently stuck at this basic issue.

How can I create 2D swinging ball in unity? I have searched for an answer for a few hours but all in vain. I am new to Unity and therefore would like to ask you, Unity pros :slight_smile:

What I want to achieve is a sprite of a ball with CircularCollider2D attached to it so that I can detect collision between it an my player. I don’t want it to react to anything else.

It bassicaly should behave like a perfect pendulum, just swinging back and forth. The rope should be a solid object which cannot bend. Also it shouldn’t collide with anything at all.

Find enclosed a quick concept sketch (my apologies for my sick MS Paint skills)

Any help would be greatly appreciated! :slight_smile:


I would use a DistanceJoint2D to keep the distance.

Use layer based collision detection to prevent collision with anything other then the player