Avoid door passing through non moving player during open/close

Opening/Closing doors do move through the player, if the player capsule is not moving. For a moving capsule, no intersection happens. I found no collision setting for the capsule, that avoids this behaviour. I found this old thread…standing-still, which gets very physics related.

So I did a solution on my own, no physics needed, which works quite nice which I want to share here. Basically, this uses overlap events for the door with the player and stops the timeline if the player is overlapping and is in a location that will block the door from further movement, i.e. in the current doors movement direction. The timeline playback gets resumed, if the player moves out of the way. The door needs a box collision component for this.

Once the player interacts with the object, an interface function Open And Close is called. If the player is not overlapping at all or overlaps, but is placed so that the door rotation does not get blocked by the capsule, the timeline gets started. A boolean flag indicates, in which direction door movement takes place.

The overlapping state is set by the following part of the blueprint. The InTransition variable is set, if the timeline is started and reset when it has finished.

From the above execution pins, the timeline gets called: if door movement is not blocked, the timeline is started in the direction determined by the ToBeClosed variable.

If the player blocks the movement, the timeline is stopped. The macro “Check Player Block” determines, if the player overlap will block door movement. It checks, if the player is in front of the current movement direction using a simple dot product. Here’s the macro content:

Timeline updates are processed as follows:

Finished: update state by toggling direction and resetting the In Transition variable
Update: just do all the animation needed for the model…

This makes the door stop moving, if the player is blocking, no matter whether the player moves or just stands in front of the door. Once the player moves, the door continues to open/close as well, until the player gives way to the door to complete its cycle. If the player presses the Interaction key again while he is blocking the movement, the timeline gets reversed.

I hope that might be useful. At least it solved my problem and is an easy to implement solution. Let me know, if there are better solutions for this.

Here’s a video link to my dropbox: Dropbox - door-movement-forum-1784524.mp4 - Simplify your life

That’s what I need. But it doesn’t work for me. :frowning: