Door goes through a wall


So I was just trying to make a door like Resident Evil 7. It kind of works. That’s until you walk in the door the other side, the door seems to break all rules of physics and decides to rotate through the wall… Or basically rotates the wrong direction.

Also, the door is based on Physics and has a box collision surrounding it. When the player ends overlap. it fires this code.

Any help would be great.

physics and SetRotation are kinda mutually exclusive.

if you want physics you’d AddForce/Impulse on hit/overlap

if you want the timeline you just gotta let it run, otherwise physics moves it out of the expected position

i get this. however you seem to have looked over that i disable physics when the timeline starts and when it finishes. i re-enable it. however this isn’t about set rotation. it’s about it rotating the wrong way instead of it not rotating to the right position.

Hey @Maxe1048!

So what I’m guessing is the reason it’s going the right way the first time but going the opposite way gives it extra movement, is because you’re taking the current rotation and adding 150 degrees to the Z axis- so the SECOND time it’s going to +300.

Try throwing a clamp on there, and instead of relative use set actor rotation! :slight_smile:

Hope that helps!

So. i looked at it. set actor rotation doesn’t work as i’m just rotating only the door mesh. i also have a box collison in there. that i dont want to be rotated.

as far as clamps go. i’m not familiar with clamps. could you maybe explain it to me or have some sort of documentation or video explain it for me?

Sure thing!

So a clamp makes sure a value that is input does not go above a certain level or below a certain level. So for instance, a Float clamp with minimum set at 50 and maximum set at 300:

In goes float-> 200: Passes through just fine with no changes as it is greater than 50 and less than 300.
In goes float → 360: As it is above the max of 300, it is set to the 300.
In goes float → 75: passes through no changes.
In goes float → -25: As -25 is below the minimum, it is set to the minimum (50)

Since you’re only rotating the mesh, yes you want to use relative. If you want to rotate it the opposite way, you need to use a boolean + branch and determine which direction the player is coming from.

i’m sorry to be so annoying :sob:

i have no idea on how to set up the clamps.

and you didnt tell me how to make it rotate the opposite direction, you just told me i needed to use a branch and a boolean.

Id use interaction collisions. One on each side. This will tell “Events” which way to rotate the door.

On Begin Overlap (Inside) → go this way
On Begin Overlap (Outside) → go this way

Use the overlaps to set a “direction” of rotation STATE. Then set to Rot A/B vars accordingly.

To get a clamp node, right click and search for clamp (float).

You pass in your value, then add a max and min. The output is constrained between those two numbers. :slight_smile: