Serious issue with collision detection (Need immediate help)

@grazer, this has been bothering me for days, now, and is keeping me from getting any further in the game.
If you test this game, after clicking on “Test Level” or after clicking the title screen, and any blue button, you will see this collision test. I have made 2 objects, both 32x32, however, I would prefer them to be 24x24, but that isn’t even the problem. I’ll run it down, using color code.

There are two Player objects, Player 1, and Player 1B, where Player 1B is connected by a proximity to a position. By normal logic, an object that is 32x64 would not be able to pass through a 32x32 gap. This is where the issue lies.

Regardless of the fact that both objects are solid, they continue to squeeze through the gaps, and get stuck between two blocks, when only P1 should be able to pass, but 1B should stop at the collision point. This is not the case, even though the two blocks combined are bigger than 32x32.

Maybe I’m not understanding how collision should work, but I’ve tried all 3 shapes, and all 9 combinations of those shapes, between the two objects, and they still squeeze between two blocks, and get stuck.


Okay… The position doesn’t move the object, it just changes its position. So basically it doesn’t move, it stays over the object to precept moving. So when your player

is under a block, the block on top just clips through because its position is updated instead of moving

It still collides with the object, if it’s lower than that. If I made a half block, or 1/4 block, the two objects will not pass underneath, if they are both half blocks or 1/4 blocks, respectively, but there has to be a way to have a 2 part body object that actually has collision, without me having to jump through hoops. This shouldn’t be this hard. I’ve wasted months trying to make an 8 directional shooter platformer, and now that I’m finally close, the top object clips, and gets you stuck. There has to be a way.

try to change the hitbox shapes?

I already mentioned that. I’ve tried all the shaped, and all combinations of shapes. I feel like the hitbox for circle is too small, and the hitbox for items moving on position do not line up correctly, because realistically, a 32x56 box should never be able to fit in a 32x32 gap. I say 56 instead of 64, because the box is lowered 8 pixels, so the body halves would overlap and connect at the torso.

Still, even if both objects are rectangles, they still squeeze through and get stuck, but I don’t want to use rectangles, because I take advantage of circle for the bottom half, for pixel ramps and hills, since grazer doesn’t have triangles.

Why not disable it? It still can work with positions

Disable what, the top half? I built a gimmick for that. I built a Metroid test engine, and pressing down disables the top half, so you can morph ball through small tunnels, but the problem is that you still get stuck when standing up. That’s the problem. I want them to hit the wall and stop, like a normal collision, not get stuck.

Hey Mhx,

I have been working on the windows exporter tonight and didn’t get a chance to look at this, but do you know about the ctrl+d trick to show collisions? That may help you figure out what is going on until I get a chance to look into it.

I did not know that. That’s very useful. I was going to request a way to view the collision sizes. I would appreciate if you take a look at it when you have some time, I know you’re busy. I’ll try to come up with a few workarounds.

@“Mhx Ar” , you want something like this?

I assume that you want player 1 to pass right through the gap, but have 1b stay behind, that’s what I tried out and this is the end product. Hopefully this will be of some help.

No. I want them to be connected at all times, and stop at a wall as if they were one tall object.

I’m going to try something stupid, and attach a really tall invisible object to the bottom half, and attach the top half to the invisible back, and use it as a ghost spine. The reason the spine has to be so tall, is because attached objects attach at the center, and that’s really irritating. I’ll mess around with it, a bit. This ghost spine will have no collision, either. I’ve done something like it, in other game engines, that didn’t have a GUI layer, so I’d attach a long pole from the player, to the top of the screen, and connect health bars to it, and whatnot. I’ll see how this ghost spine works, comparatively to the position attempt.

Why not just make it a whole object but have a gun object instead of a top half object

Animations, and crouching. Running and shooting, vs running and not shooting, or charging a shot while running, or standing still. Legs and upper body would be on separate animations, to multitask. Also, when I crouch, the top half alpha 0s, and disables, so I can crawl through small spaces, and dodge stuff.


I wish rotation changed the hitboxes