GDevelop
GDevelop copied to clipboard
collision mask creation/management in beta 112
Describe the bug
Before beta 112, an animation could have no collision mask. Now, in beta 112, when you choose "use custom collision mask" it creates a 32x32 pixel mask in the center of the sprite. If you try to delete it, it reverts back to the default mask. If you set all the coordinates to (0,0), it still maintains a 1 pixel mask.
If you use an Object that has an animation that doesn't have a collision mask in beta 112, then it works as it did before. But as soon as you modify the Object and click "Apply," the new "at least 1x1 pixel" mask is applied. This causes collisions to happen when they didn't before.
To Reproduce
Steps to reproduce the behavior:
- Open a project created before beta 112.
- Open an Object that has an animation that doesn't contain a collision mask.
- Click "Edit Collision Masks" and you'll see that a 32x32 pixel mask has appeared in the middle of the animation that previously had no mask.
- Click on the trash can next to the new 32x32 mask, and it will revert to the default mask.
- Change all the coordinates on the new 32x32 mask to (0,0) and preview game and see that it triggers a collision.
Other details
- macOS BigSur (11.4)
- GDevelop beta 112, Desktop version
- There was nothing mentioned about this in the release notes, so I am assuming it's a bug.
Ah that's a great example of a bug that turned into a feature 😬
No mask collision at all was never really supported. Could you explain a bit more in which case you would need to check for collisions while having actually no collisions mask on an object?
In the worst case scenario, you could always go and erase the collision mask in the project JSON, but I'd like to understand better what you're trying to achieve.
While there are others, the primary issue I'm having is that I have many events where the Player collides with an Object and something happens (e.g., coin, enemy, etc.). When the Player dies I have it change to the Dead animation, and on that animation I had no collision mask so that while the dead Player is bounced up then down (Mario-style), if it happens to collide with one of those objects then nothing happens. Which is good, because I don't want a dead Player collecting coins, etc.
I realize there are other ways to do this, such as with a variable. But I started going through all my Events are there are many that would need to be changed. So, I was hoping to keep it working as it is. But apparently the bug was in the previous versions, and this is the fixed/correct way in beta 112.
An action to disable the collisions can be an idea.
The IDE properties are easier to manage, as the toggle button for "Share same collision mask ...." I guess a new one called "Enable collision" is welcome, and may be only for the select animation?
In term of design this is quite clear.
paint mockup =>
I reopen my capture is only a mock-up, it's not integrated.
Bouh: Would the idea be that this toggle would be animation and/or frame specific? Or would it be object-wide/all animations?
At least specific to the animation, it makes sense?
I closed it because it was made clear to me this is not a bug...though as a feature it's a pretty big change from how things use to work.
FWIW, I would suggest adding an Action that can activate/deactivate a collision mask on an Object. Either for the Object as a whole, or for a specific animation. That way you wouldn't have to choose one way or another within the collision mask menu.
I don't think this should be thrown away as a "feature", many users complained that this change broke their games. I think that if this is breaking games of many users, it do should be considered an issue.
A solution that was suggested by one of the users reporting their games broke was instead of having the deletion of a collision mask revert directly to the default one having a dialog along the lines of "If you delete this collision mask, the object won't be able to interact with any other object. Did you mean to revert to the default collision mask? (Yes/No)". If it was never supported, then let's change the code to support it, if users rely on it.
Just to be clear, this is only "breaking" when you edit the collision masks of an object that used not to have any right?
When you edit the Object in any way (add/change animations, add/change behaviors, etc) and click Apply, that’s when a collision mask is forced on an animation that didn’t have one before.
If you open the Object and look at the collision masks, it will show a new 32x32 pixel one added. But, if you then hit Cancel, it does not take effect.
I started making a list of all the Events that would need to be modified, and am up to around 55. And those are just the ones I noticed, I'm sure there are more that will come up when having to test again. It's good to know it's not just me having this issue. :)
I used this "feature" for my game's hit detection system The sprites had a separate hitbox object for their actual hitbox and i used the animations' hitboxes (because i could easily make them fit with the sprites) And only had hitboxes for when i needed them to deal damage. But now, every frame has hitboxes so it's always dealing damage. It was working perfectly fine before but now i'd have to rework a HUGE portion of the game I would've just added a warning that it may break a bit when deleting a hitbox, but allow people to do so anyway, cause as Arthuro said it's not only just me
Or at least like Make it an actual feature instead of a bug Like you can toggle a switch that says (Doesn't have a hitbox) or something, which would delete the hitbox for that specific frame or something along those lines I'd be so thankful if you considered any of those options
Even made a little mockup of how it could look
Khaled here from Coriander Games... This feature (bug) really needs to get back and maybe with some polish to it to prevent any crashes and so on.
Let me explain in details why this is super useful to have it in the engine:
First >> it's 10 times quicker than checking every single event to say check for that frame and that frame and so on...
Second here are 2 quick examples: First example:
1- You have an attack animation that has 10 frames. 2- You need to have frame 3 and frame 6 to have a collision mask and the rest doesn't have a collision mask (I know you can check by frame but when you have a project where events are like noodles sometimes, it's going to be a nightmare to check for every single event that needs to have these 2 frames checked)
If that feature (Bug) is here >> you would disable the collision for the frames and keep the ones that you need to check >> it's faster and quicker than going through your events to check every single event in the whole project to see if it's checking that specific frame or not.
Second Example I actually used in my game Miko Adventures Puffball:
So you have a door that has 2 states >> open or closed I would put a collision mask when it's closed >> remove it when it's open.
It's just much much quicker and I don't need to do anything in the events, just removing a collision and adding a collision. It's cleaner and quicker.
Now I'm stuck in a situation where I'm dealing with similar situations in my upcoming game "Melted Fate" and I need to go through the whole project again to check if that frame and that frame are active and so on... just a nightmare to go through.
Please this feature (Bug) >> needs to come back with polish added to it. It was a perfect addition to the engine no doubt...
Hello @CorianderGames and @ToasterPower777! Would you mind checking the topics mentioned on this conversation: https://forum.gdevelop.io/t/being-able-to-create-trigger-masks-similar-to-collision-masks/45587/6, and letting us know if that applies to what you're describing? It's seems like individual masks might be a thing, but there is not enough input on the forum yet for the team to understand the possible use cases for such feature. Do vote with a heart and/or add a comment to those conversations so we can centralise them there.
Thank you!