Collision Mask Is not Applied for Physics 2.0

Good day happy hearts :sparkling_heart:

I have applied Physics2 for the object behavior, it has its own collision mask set up and I have chosen polygon, however it does not work and still uses default box. In addition it shows warning triangles that hovering over do not say anything.

I have watched tutorials on Physics2 and tutor had no issue applying polygon mask to the sprite. What have I missed?

Hello!

In your screenshot, you have a bunch of exclamation points next to your collision points, which should show an error. Them not showing anything when hovering over them is weird and definitely seems like something missing.

The marks are there because the shape you have made is not convex, which isn’t supported by the collision system (and in fact is supported by almost no collision system). Since it is invalid, it is ignored by the engine as a shape.

Physics objects don’t support multiple collision shapes on one object, so your only option would be remove any concave portions of the shape.

Thank you for taking your time to help me, took a few seconds to figure out what you talk about :slight_smile:

I just recall from the past CONVEX shape was not a mandatory at list not for a physics as I was making it as weird as I wanted. My old projects still have this non-convex masks applied on them - I have to remake them right, they wont work any more?

So you ONLY allowed convex shape collision masks, be it sprite for collision check or physics?

Zero possibility to make more precise collision mask like I have on the screenshot?

P.S. - Any way to copy/past behavior from one object to another?

2D Game engines in general tend to only allow Convex shapes, correct. As far as I know all 2D physics libraries(at least public ones) exclusively support convex shapes only. GDevelop uses the Box2D library for it’s physics, which also does not allow concave shapes.

On non-physics behavior sprite objects, you can add multiple collision masks to a single sprite object, and could use that to build out concave shapes with multiple concave polygons.

I went back as far as GD5 beta 0.89 from a few years back, and even there only singular concave shapes were allowed. I also confirmed Box2D has never supported concave shapes. Maybe you’re thinking of non-physics objects with multiple mask polygons?

Closest way I can think of would be to duplicate the original object and then modify it as needed to be a new object. If you’re needing a different object type, you cannot paste behaviors as some behaviors are object type specific.

2 Likes

That is correct, non-physics collision masks. Once again thank you for additional explanation and in depth view on a subject, educated I am now on the matter :slight_smile: here is a flower for you :tulip:

1 Like