Crushing characters in a sliding door

I want to implement sliding doors in my game, but I have a problem, when a character (Either NPC or player) stands in the open door as it closes, the door just clips trough it or teleports the character to the side.

I’m trying to figure out how to detect if there is something in the way and deal damage to it or open the door back again.

The simplest option would be a small collision box at the end of the door, but unfortunately this would trigger even if there is space for the door to move. If there is space to push the character, push it, but if there isn’t, kill it, but I don’t know how to properly check for space, considering my NPCs are all of different sizes.

is there a way to check for free space?

that collision box at the end of the door is the right idea, you just need to tweak what it can collide with. Namely pawns.

But then it would trigger even if there’s space to push the pawn

Put one on the door edge and one on the frame where the door meets it when closed. If both overlap pawn apply damage.

They wouldn’t overlap, because there’s a person in the way.

No, If EACH is overlapping a pawn at the same time. More specifically the same Pawn.

On Door Begin Overlap → IS PAWN?: True → Is Frame Overlapping Pawn: If True → DMG

On Frame Begin Overlap → IS PAWN?: True → Is Door Overlapping Pawn: If True → DMG

Oh, I see! Yes, I imagine this would work. I’ll have to experiment with implementation, but so far this seems like the most promising option.

Forgot to mention that those collisions ignore everything, except overlap pawn capsule (capsule component). This setup only allows the character capsule to trigger the overlaps.

I added a custom collision object channel in project settings for the pawns capsule component. This separates the mesh from the movement aspects.


Door/Frame Crushing collisions

One more pic for clarity of component structure.

1 Like