Open door outwards, away from player

Hi,

I have a door system working pretty well by stopping a timeline animation when it touches the player character, not knocking the camera around anymore.

However, I can think of scenarios where opening the door outwards, away from the player can be useful. I figure it could be done by having two colliders on each side of the door and checking our lighttrace to see what face we are facing. But then what?

I feel like using the camera’s world rotation and the door’s orientation in the current room, we should be able to give it a rotation that would open the door away from the player, into the new room with some fancy math. I am stuck at figuring out what that degree to rotate is. It is either 90 or -90 but which one depending on which side we are?

Thanks in advance!

If you mean to have the door open automatically, just use 2 collision boxes, one on either side and driving a timeline/timer/etc to open the door Away from itself.

The rotation value will depend on how you have things set up.

It helps if you plan to rotate an object on one axis to have its initial value be 180o so that you can add/subtract from it without dealing with values below 0 (add 360) or over 360 (subtract it).