How do i use physics with a ring?

short summary here but i want my game to have a ring, with a ball that can bounce around inside the ring ill tey and show an image showcasing what i mean

thanks for any assistance :slight_smile:

I would try to create 2 half disks, and stick them one to the other.

Concave shapes can be tough. Can you add more details? What do the shapes represent? Is this a side view or top down? Do the balls have gravity that makes them fill the shape like a bowl or do they bounce around like a billiards table? Will there be multiple balls inside the ring?

Collisions within a ring are tricky, and can’t be done with one physics object.

The way I’ve previously done it is to break the object into smaller, repeatable pieces, each with a valid physics collision mask. So your ring would be this piece, a 1/16th (or 22.5 degrees) section of the ring that you repeat 16 times around the ring centre:

with this physics collision mask:

Here are the test events:


And the result:

RingBall

oh wow, thats perfect thankyou very mucch for that.
im still a bit confused by what your doing in the first to images, i understand the principle of duplicating sectors into a ring but i dont exaxtly understand how to put that into prcatise. i will try and copy what i can from the images provided.

Thankyou very much for your help though :smile:

All I did was create a ring in paint.net and then cut it into 16 equal segments. The segment I used is the one on the right:

I then created a sprite with that segment as the image, and added a polygon collision mask in the physics behaviour:

2 Likes

sorry for the later response. been a bit busy.
thats perfect. thankyou for that extra explanation. made it much clearer.
thats exactly what i was looking for, so thanks heaps for the responce!