Problem with the collision system

Hello! Can anyone suggest me a way to make an efficient collision system? I’d like the player to stop exactly when its edge is in collision with a solid object. I tried to use the “Separate two objects” event and it works perfectly if the player collides with a single object, but if it collides with two objects it generates an unpleasant vibration. Thanks.

Hi,
Can you share a screenshot or details of the unpleasant vibration issue?
You can use Physics for clean collisions, but it’s quite heavy (requires more processing power).

Sorry, I can’t take a screenshot of the vibration because in a single frame it looks normal, it just moves up and down very fast. I’ll try to use Physics to see the effect. Thanks for your advice!

it’s okay if we don’t see the vibration, just show the visual set up and the related events. :slight_smile:

Ok, here it is.

Hmm, is that a standard platformer or…?
If the solid is ground, you should try the platform/platformer behaviors.
And if it’s a wall, try the topdown behavior.

Isn’t the vibration caused by your position rounding?

No, it isn’t a platformer, it’s an RPG, but I could try to use the platform behavior without gravity.
Anyway the rounding does not affect, even without the effect it is the same.

Are there any other positional changes in the events further down, that you haven’t screen shot?

I don’t think so. If you want you can try the “Bomb the Crate” example: if you move the player in the same position of the screenshot and press the Down key you will get the same result.

You could make a grid based movement ala pokemon. That way you can only collide with 1 object.

Not in this screenshot.

image

The problem with the Bomb the Crate example is that one of the sprite animations is a little shorter than the others, and doesn’t quite fit in the hit box. The head stays in the same position, but the feet are a pixel or two above the hit box’s lower bounds. As a result it appears not to be touching the crate, where as the hit box is colliding with the crate, it’s just the image itself isn’t:

image

Check the hit boxes on all your character sprite animations are in line with the bottom of each character image.

In that screenshot the player isn’t colliding with two objects, for this the vibration is absent. Anyway in my project I use the same hit box for every animation of player and all pictures of the player have the same size.

Do you mean a system like RPG maker? Yes, it would be more easy, but if there was a way I would prefer the player to move freely.

Maybe don’t use collision and instead check position of player and terrain and don’t allow movement, if position is blocked.
That would eliminate all yanks coming with the collision. No clipping/stuttering/vibrations/overlapping.
This could be reasonably done with 4 directions movement

Do you mean anything like “If position of player ≠ position of solid add to player an istance force etc.”?

If position is … and movement key is …
yes.
You could just activate/deactivate the top down movement behavior.

I tried but unfortunately the player moves between pixels, so he is never in the right position.

Looks like a bug.
I reported it on the github.

Thanks! Then I’ll check there for any updates.