How to do convex collisions in 2d?

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

I am hoping to build marble races in godot, like is very common in Algodoo. But it requires a lot of curves and I’m not sure how to achieve such a thing in godot. Is there a way?

https://www.youtube.com/watch?v=2KaSalK-DfY&ab_channel=MIKAN shows an example of one.

:bust_in_silhouette: Reply From: ItsNoGood

For the marble track you should be able to just make a StaticBody2D and add however many concave and convex CollisionShape2Ds you want to it. Your marbles can be RigidBody2Ds and will collide with the StaticBody2D track. I’m not sure what the best way of going about making very curvy shapes but you could map a path’s points onto a collision shape polygon like this guy shows https://www.youtube.com/watch?v=y1pxCxM36pM