Custom Collision Mask for Physics Object

Hey there guys,

Just wondering the best way to create a complex custom collision mask for a physics object, such as the image I have attached. It seems that the Polygon physics mask is limited to a certain number of points.

I am aiming to have a ball roll down the terrain image I have provided.

Any help would be great!

I would try to cut the terrain in portions and flip the sprites to mirror the slopes and reuse the custom points.

Thanks for your reply mate!

I will give that a go.


I guess I should clarify.

How do I actually break the image up into multiple components?

Cheers, Jai.

You need to do that in your favorite image editor, GIMP for instance.

The good thing is that you can make various slopes and heights and then easily combine them as you wish.
If you do things right, you’ll even be able to generate your terrain procedurally (the game builds a random terrain every time you load it). For that, you should use a grid to create your slopes and then assign height variables to each image.
Hope I’m making sense to you.

1 Like

Thanks for your advice mate, definitely gives me strong direction. I will let you know how I go. Cheers!

1 Like

I have a similar issue but I never made to solve it. Do you have any working example?