[SOLVED] How do I handle custom collision mask?

Hi !

I am trying to make a custom collision for my character to make it stand more precise on a platform, but when I change the collision mask, some points probably change and collision doesn’t work anymore, how could I fix the problem without affecting the animations, to keep it as it is but still change the collision mask ?

Screenshot 2024-02-21 220957

Hi,
you could use a hidden sprite that is your actual collision box. Your character sprites would be just attached to this sprite and it prevents you to run into any problems with your animations. Here is an example project that demonstrates how it works: Old platformer - a game example from the GDevelop game making app | GDevelop

1 Like

Hey !

Thanks a lot of taking care for the problem. The option you told me is smart, and I immediately tried to recreate it… But I was not able to do so this time despite it worked in the example. I did exactly as supposed to do, but collision was still taking in account the original " fat " mask, I have eventually solved the problem just now, by my first idea of custom collision mask, I have made it much slimmer, everything works, but I don’t know why, which is most of the time not enough for me " to just work ", but this time i truly don’t know what caused it to work again :{

1 Like

Hey Daniel,
It’s good that you want to know why something works. That’s very important for preventing headaches later!

For Drona’s suggestion of using serparate collision mask, that one didn’t work because you need the Platformer behaviour on the hidden sprite, not the character’s sprite with animations.

Currently, your slim collision mask works? That’s good!
The collision masks simply changes how the Platformer behaviour interacts with the game, it doesn’t care how big your sprite’s actual images is.
As long as you make it use the same collision mask for all the animations, you shouldn’t run into problems when changing animations

Hope that let you know some things

1 Like