Saturday, April 26, 2014

UDK : The One Sided Door Problem

UDK : The One Sided Door Problem

Here is the problem: 

I want a door that is open when you are outside of a room but closes when you are inside and I want it to auto open if you approach it from the inside or outside (if it happens to be closed from the outside)
Here is the door from the outside (it should be open like this)

This doesn't sound difficult but I had a bugger of a time getting this done properly. My initial solution from a few months ago was a hack and I didn't like it.

And no... a simple trigger touch/untouch does not cut it. Two triggers controlling the door has other issues (that was my intial solution). You need 1 trigger to control the door for a bullet proof solution.

Solution:

This solution is bullet proof.

 kismet

the area from the top

The circular area is the room interior.
The large green circle is trigger_25. It encompasses the room both horizontally and vertically.
The smaller green circle is trigger_26. This is the door trigger.
The small red rectangle trigger_26 is sitting is the door.

To do this I needed to keep track of 2 things:
1. Are you in the room
2. Is the door open or closed

If you are in the room, the door auto closes when you "untouch" trigger_26.

If the door is closed, the door auto opens with you "touch" trigger_25.

This is intuitive and models exactly how I wanted it to work.

No comments:

Post a Comment