I have a problem with the Collision mask of my Player and other Plattformobjects.
Sometimes when I jump on an object this happens:
The Player seems to fly and sometimes it also works like a step and I can reach objects which are normally to high for a normal jump…
These are the Collision Masks:
After sketching the objects in Piskel I also crop the sprites.
I hope someone has an idea?
I don’t know if there’s a different way to fix this, but I always see people using colision box with rectangles and I believe it’s to avoid this kind of thing. Platform example:
I particularly prefer to make the collision boxes a little smaller than the images. The actions sometimes happen very fast and having very accurate collision boxes can sometimes give the impression that the objects have not touched each other
Maybe the platform example can help you. Check it out
thanks for your reply - I tried it and used the hitbox exactly as in the platform example and even made it a lot smaller but the problem stays the same…
Do you changed the colision box on barrel too?
Where are the origin points of the sprites placed?
It looks like the barrel one is on the top left, when it should be on the top and middle. Theory has to be checked anyway.
Yes. Actually I am really surprised and I have absolutely no idea how this could happen:
The Barrel is not a platform anymore, I put the hitbox in front of it, so you can see it. And another hitbox behind the Player - the red one. I walked the Player/hitbox again to the edge and the hitbox fell down, the Player not.
These are my events:
I also tried to delete the Behavior of the Player “Platform Charakter” but then he doesn’t move anymore… Maybe there is the problem???
Okay, I am quite sure now that the problem is that I didn’t delete the Behavior of my Player “Platform Charakter” but I don’t see the bug why he isn’t moving with the hitbox… (the hitbox moves and jumps, the Player stays on his position, making the animation for running without moving forward)
You are only changing the position of your player once at the start of the scene. After that, the action won’t trigger again. Move the player set position action to an unconditional event.
And I don’t see how using a rectangular collision box will help. You’ll have a collision box that’s not as accurate as you had before. You should be able to use the hitbox of the player.
So, getting back to your original problem. Does the charater have more than 1 animation frame? If so, is the redefined collision mask applied to all frames?
@kater I’m sorry make you did all the changes for nothing. I thought something like this was going on here.
That’s why I thought that rectangle box collision could help. But looking better your character is quite far away.
Is the barrel on another layer that your camera isn’t tracking (or tracking at another speed)?
Another thing you can do to see what’s happening is to turn on debugging view (of bounding boxes). This will show all the boundaries and collision boxes for all objects, and may give a hint to what is happening :
Thanks for your advices. The charakter has more than 1 animation frame but its edited for all of them - I just looked it up.
The debugging tool is really interesting! This is how it looks (I made the collision mask of the barrel even more smaller than before):
So,it looks like the blue frame of my charakter sticks so the red frame/the collision mask of the barrel but ignores the blue frame of the barrel? I’m not sure how to interpret that.
@Rasterisko its alright, I am very happy for all of your help here, trying to find a solution for my problem… and besides I am learning a lot! (Both objects are on the Base Layer)
The blue frame is the outline of the sprite. It shouldn’t have any input to the collision.
What behaviours do you have attached to the sprites? Platformer? Physics2?
How are you moving the player?
My Player has the behavior “Platform Object” (and Flickering but only when it gets hit by enemies), the option “can grab platform ledges” is not activated. And the Barrel has the behavior “Platform”. The option “ledges can be grabbed” is also not activated.
This is how I move my Player:
I was able to reproduce the problem without difficulties.
Player has not marked the option “Can grab platform ledges” and the object with platform has not marked the option “Ledges can be grabbed” like you did, Kater.
Looks like the collision mask is “completing” the box. Something like this:
Oh, really good idea to try it on another platformer! And really interesting. So I just have to accept it I guess? …or try it with another “extra” collision box again as you told me before @Rasterisko.
I can’t confirm it’s a bug. I think someone of Gdevelop Team need look this.
That looks like a bug, GDevelop has two types of collisions: the AABB, which is just the top & bottom left and right positions, for quickly seeing if the object is touching another one without doing a full collisions check which is much longer to execute, and the actual one which used complex maths and the hitboxes. While GDevelop should begin with an AABB check to quickly exclude far away platform from collisions checks, it shouldn’t stop here and do an actual collision check.
You can submit a bug report at https://GitHub.com/4ian/GDevelop/issues/new
I sent the example on github and 4ian said it’s not a bug. It’s a limitation of platform character behavior (Custom hitboxes are indeed not supported by the platformer object behavior - only the rectangle surrounding the red polygons will be used.). And concave polygon is not suported on game engine, so my example wouldn’t work, even for another behavior. He explained what’s going on here: Collision mask is not being considered exactly as it was made · Issue #3344 · 4ian/GDevelop (github.com)
@kater, I think the only solution will be use a rectangular collision box for your character and make the different collision box just for your platforms (like the barrel). And never use a concave shape for the colision.
Thank you @Rasterisko!!
I am really happy to know now whats going on.
Your example is incorrect. If you look at the collision box in the editor, you’ll see the warning that the polygon is not convex. GDevelop then defaults to the full image collision box.
Sorry, I didn’t see your response later on. Ignore my comment.