Colision Masks (Polygon (INVALID: The polygon is not convex)

Hello to the GDevelop comunity :slight_smile:

My first post, but Im using this fantastic peace of software for about 2 weeks and reading a lot :slight_smile:

Im building a car driving game, and everithing works greate if I simple use rectangular sprite objects adding the physics behavior, but I want to use a curve sprite emulating montains and the car as to cross it all, but the bigest chalange is the image paths as colisions.

I see in this public video that there is an option to paste all image coordinates at once, but I can find it on the beta version GDevelop

Can some one point me to the right direction :slight_smile:

Thanks to all :slight_smile:

I Hope I can contribute to this project also later on.

P.S - I have worked and have sucessful build some months ago games using for exemple pixy.js, Unity3D, Construct 2 , and I can say for building HTML5 games, its the most quick, easy and professional software I have seen (yes, Unity3D has a solid software game engine, and for building 3D Games is the best, but for 2D Games GDevelop wins).

@Florian Keep it up :slight_smile:



Any help on colision maks in a round object?

I Cant manually add it on GD because wen I add all coordinates it shows:

Polygon (INVALID: The polygon is not convext)

Any Help?


If you looking for the option shown in the video, that option available only in the Native platform.
You can’t use custom collision shapes in HTML5 games.

In case you need a round collision shape, you can add the physics behavior to an object and in the physics properties of the object you can select circle collision mask but no custom collision mask in HTML5.

In case you are trying to make a custom collision mask in Native game and you get “polygon is not convex” message, I believe that means one or more collision points are in wrong position, the points can’t be dragged over each other. Keep the points on the edge and change the shape by moving the points but do not drag them over each other, instead, add more points if you need.

1 Like

Many thanks :slight_smile:

I saw the option on NATIVE :slight_smile:

For HTML5 if I select “circle”, I still cant add more then 4 vertices and the same error shows.

Is there any woraround for this?

Thanks again for the help :slight_smile:

If you select circle the physics engine generate the collision shape you don’t need to edit and it is just pointless to edit the collision shape in HTML5 because even if you edit the shape in the editor, during the game the HTML5 engine simply going to ignore the custom shape. The HTML5 engine able to use only square or circle shape and both shape is automatically generated by the physics engine. In case you need a bigger or smaller shape than the original object, you can cheat and use a second invisible object as the collision shape for reference that is remain invisible during the game and you can make the visible one to follow the position of the invisible one and you can make the invisible one to handle collision and physics.

If you have a ball and you want to make the ball rolling on the ground, you need to add the physics behavior to both (ball and ground) and set in the properties of the ball to have circle collision shape and set the ground to be square.
After, you need to add a physics event to apply gravity to the ball on the Y axis to make it fall down and roll on the ground and behave just like a ball. There are some physics examples included with GDevelop I suggest to take a look at them.

If you are trying to do something like on the video in HTML5, I don’t think you can do anything like that in HTML5, because you simply can’t use custom collision shapes. The only thing you could do I guess is using square objects in different angles to make ramps and slopes but not curved objects.
Alternatively you can try to change the angle of movement manually when you are about to move up and down on hills.
If you need custom collision shapes, regardless if it a physics or non physics object, it can be done only in native game.

About the error message my only guess what I was already told you before, one of the points must be in a wrong position compared to it neighbors. Really, the collision shape editor of GDevelop is not the best. I suggest to try to use simple shapes such as square, triangle, pentagon…etc that you can make out of only a few points try to make it as simple as possible, don’t use many points in a small area it is also helps with performance.

Thanks again :slight_smile:

I will use rectangular hidden sprites to emulate the hills and montains :slight_smile: has a solution for this, like GD its also based on pixi.js engine :slight_smile: maybe in the future :stuck_out_tongue: