A Torus collision shape subtraction

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Sadra

Hello friends I hope you have a great day. Is there a way to make custom Torus collision shape like the image that I have liked (( one hosted at ImgBB — ImgBB ))? This image was created by Photoshop to show you what exactly I mean. Technically I want a way to do it with some subtraction. Like removing the overlapping area of two circle shape so I can change the center shape’s position. I dont know it is possible or not. Thanks for your help.

the image

If your torus is static, you could use two CollisionPolygon2D with build mode set to Segments, and make your shapes out of segments (could use some code to make it in the shape of a circle?).
One would be the outer circle, and the other would be the inner circle. But because they would be segments it means the “inside” will not be solid, only the segments will collide. So it’s not really subtraction, it’s just two circle segments that happen to be concentric.

If you want to make this shape move, it might not be possible, because a donut is a concave shape, and Godot physics don’t support concave dynamic objects.

See also https://forum.godotengine.org/101062/circular-collision-shape-with-object-inside?show=101062#q101062

Zylann | 2023-07-07 13:02