Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collision mask is not being considered exactly as it was made #3344

Closed
Rasterisko opened this issue Dec 9, 2021 · 16 comments
Closed

Collision mask is not being considered exactly as it was made #3344

Rasterisko opened this issue Dec 9, 2021 · 16 comments
Labels
💨 Technical debt removal Removing technical debt/unused/dead code This is a feature :) Not really a bug This is not really a bug or a missing feature, probably won't change

Comments

@Rasterisko
Copy link

DESCRIBED THE BUG

It seems that the collision system is not considering exactly how the mask was made, but by completing a rectangle with it.

TO REPRODUCE

  • Create a object with platform character behavior and another object with platform behavior .

  • Make a complex colision box like this and try to interact them:

Colision

and it looks like it's happening this:

Colision edited

OTHER DETAILS

@4ian
Copy link
Owner

4ian commented Dec 9, 2021

Custom hitboxes are indeed not supported by the platformer object behavior - only the rectangle surrounding the red polygons will be used. By the way your polygon looks concave which is also not supported in the game engine (platformer engine or not)?

Only custom hit boxes on the platforms are followed exactly.

@Bouh Bouh added This is a feature :) Not really a bug This is not really a bug or a missing feature, probably won't change 💨 Technical debt removal Removing technical debt/unused/dead code labels Dec 10, 2021
@AlexandreSi
Copy link
Collaborator

Custom hitboxes are indeed not supported by the platformer object behavior

Maybe I don't fully understand what "support" means, but if you specify a custom hitbox that is a rectangle, it works just fine. Maybe we should add a warning, similar to #3348.

@AlexandreSi
Copy link
Collaborator

We could even add on the visual editor, for objects with platformer behavior, another rectangle that represents the rectangle surrounding all the masks that will be used when the game is running?

@tristanbob
Copy link
Contributor

tristanbob commented Dec 10, 2021

The physics behavior uses a non-standard collision mask that is configured inside the behavior properties ("Behaviors" tab).

Perhaps it makes sense to "show" the platformer collision mask on the behavior tab? (with a note that explains what it shows, and to modify the collision masks using "Properties -> Edit collision masks")

@arthuro555
Copy link
Contributor

Maybe I don't fully understand what "support" means, but if you specify a custom hitbox that is a rectangle

My understanding is that only the AABB is supported, not the hitbox itself. So if you would make a triangular hitbox, which should be valid, it'll keep on using object bounds instead of the actual hitbox:
image

@AlexandreSi
Copy link
Collaborator

Actually, on your screenshot, the object's lower bound is the same as the hitbox's lower y. See:

image

The recent changes by @D8H only considers the Y range of the hitboxes of a platformer:

image

So what do you say about this feature:
On the collision mask editor, if the object has the platformer behavior, we add a checkbox below the preview that allows to display the bounding box used for the platformer to compute which platform it is on.

I can do it in #3348

@arthuro555
Copy link
Contributor

That's the issue though, we shouldn't observe that only the lower bound is used and say "look at the code that's intended", because of course the code does that, how else would we be reporting that behavior! The bug report is about the behavior of the platformer behavior being incorrect, which it is as it should not be using the hitbox bounds but the hitbox itself for collisions. The solution is to change the platformer behavior to respect the hitbox, not to warn that it will only respect it's bounds (AABB).

@D8H
Copy link
Collaborator

D8H commented Dec 13, 2021

That's the issue though, we shouldn't observe that only the lower bound is used and say "look at the code that's intended", because of course the code does that, how else would we be reporting that behavior! The bug report is about the behavior of the platformer behavior being incorrect, which it is as it should not be using the hitbox bounds but the hitbox itself for collisions. The solution is to change the platformer behavior to respect the hitbox, not to warn that it will only respect it's bounds (AABB).

It's possible to follow the floor using the exact collision mask, but it will makes the code harder to maintain so, at the time, we decided to wait and see if users really needed it.

@Rasterisko , the description doesn't explain what the intent was here. What is the use of this collision mask in the game?

@Rasterisko
Copy link
Author

Rasterisko commented Dec 17, 2021

@D8H , In fact I was trying to help a person who was wearing a collision mask with multiple precise points on the object with platform object behavior. So I did my test with this exaggerated collision box to make it even clearer and thought it was a bug, because like the title says "Collision mask is not being considered exactly as it was made" (I didn't know about the concave collision mask not being valid in the game engine). But in his original game the mask is not concave and the collision points follow the character's drawing, although the problem persists since it is a limitation to the platform object behavior.

Here the link of the discussion in the forum: https://forum.gdevelop-app.com/t/problems-with-the-collision-mask/36848

And I'm sorry it took me so long to answer. I'm not in the habit of using github. But I'll be more attentive

@D8H
Copy link
Collaborator

D8H commented Dec 18, 2021

Thank you, I answered on the forum. I think that a rectangular collision mask will work better in this case too. Complicated shapes will often have issues with flipping anyway.

@Rasterisko
Copy link
Author

Okay, but I think the person already understands. When the 4ian replied I suggested on the forum to use a rectangular collision box and explained the situation. Thanks for the support!

@Silver-Streak
Copy link
Collaborator

Thank you, I answered on the forum. I think that a rectangular collision mask will work better in this case too. Complicated shapes will often have issues with flipping anyway.

Just want to double check here as I don't want to confuse the forum poster:

With the current logic/intended logic changes/etc, this still allows someone to have a center point (for flipping and ohter purposes) be outside of the collision mask entirely, correct?

This is important in instances where a user has a sprite with a weapon on the end, and they need the hit box to be all the way to one side, but need the center point to not be in the collision mask at all. Or in instances where they want the flipping to happen not at the horizontal center of the collision mask but more to one side or another of the collision mask.

This worked before the platformer rework, so I want to confirm this logic is still possible going forward.

@D8H
Copy link
Collaborator

D8H commented Dec 19, 2021

With the current logic/intended logic changes/etc, this still allows someone to have a center point (for flipping and other purposes) be outside of the collision mask entirely, correct?

As long as the collision mask is a rectangle, it should behave the same. But, I wouldn't advise to use one that is not symmetrical to the center point because it makes the collision mask to kind of teleport which will result to a lot of issue like this one:

This is important in instances where a user has a sprite with a weapon on the end, and they need the hit box to be all the way to one side, but need the center point to not be in the collision mask at all. Or in instances where they want the flipping to happen not at the horizontal center of the collision mask but more to one side or another of the collision mask.

This worked before the platformer rework, so I want to confirm this logic is still possible going forward.

It's still possible, but I don't see why one would want to do this. In my opinion, a character that is stopped against a wall by the extremity of its accessory will probably look strange.

@Silver-Streak
Copy link
Collaborator

Thanks @D8H. That addresses my concern.

While I agree uses cases for it can be odd, it is not uncommon, so I just wanted to ensure that functionality hadn't been lost.

@AlexandreSi
Copy link
Collaborator

Great to see you discussed it further!
Do we carry on with a rectangular hitbox? And if yes, do you think it's okay to add the rectangle as mentionned in #3344 (comment)? Or do you fear it will disappoint users? Maybe I can add a link to a forum/wiki page where it is explained why it behaves like that.

@Bouh
Copy link
Collaborator

Bouh commented Jan 23, 2022

This is a missing feature, which is not a bug, so the issue is not a problem. I'm converting this thread into a discussion.

Repository owner locked and limited conversation to collaborators Jan 23, 2022
@Bouh Bouh converted this issue into discussion #3543 Jan 23, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
💨 Technical debt removal Removing technical debt/unused/dead code This is a feature :) Not really a bug This is not really a bug or a missing feature, probably won't change
Projects
None yet
Development

No branches or pull requests

8 participants