Look at door to trigger it to open, whilst inside it's Trigger volume, leaving other doors closed

I’m building a scene to be used with a Samsung Gear VR and I’m having some trouble getting my doors to work the way I want them to. Because of the lack inputs on the headset the idea is that the user will simply look at a door for a second or two and if they are close enough the door will open. Then once they leave the trigger volume around the door, after a few seconds it will close again.

I’ve got this working using the system below but I’m having problems when I place multiple versions of that door. I’m guessing the problem is because I’m not telling the character blueprint which specific door to send the “OpenDoor” command to. I’m a complete beginner when it comes to this so I don’t really know where to go from here, could someone help?

When I’ve only got one door in place this system works fine, but once there is more then one the doors start behaving strangely. Some never open, some open and close when entering the trigger volume of a different door.

Here is the blueprint for the door:


Off the edge is the timeline and rotator to actually move the door.

Here is the Raycast section, I’ve added this to the standard First Person character blueprint:


I’m pretty sure the problem is that I’m sending the “OpenDoor” command from the player to all doors as opposed to the specific door being looked at, but I wouldn’t know how to define that. Can anyone help?


On your line trace, replace that with a ‘LineTraceByChannel’. This will return a single actor that you hit. Take the ‘OutHit’ pin, drag it out and drop it. Select ‘Break Hit Result’ from the context menu, and look for ‘Hit Actor’. Cast this to your door. If the cast works, call Open Door on that door. Beyond that, you’re also making your logic more complicated than it needs to be. You can remove the top line entirely in the second picture, and you can replace all your booleans in the top with ‘isPlayerInVolume’ and ‘isOpen’. This should solve your issue and also make it so that you can work from here. Oh, you also need to close that gate at the top.

That worked perfectly!

The gate was also giving me some trouble so I got rid of it all together as I couldn’t get the “Close” to trigger properly for whatever reason. I went down to the two variables you suggested in the Doors blueprint, “isOpen” & “isPlayerInVolume”. The Raycast triggers the OpenDoor function but that gets blocked by a branch using isPlayerInVolume, which goes to another branch to make it stop if “isOpen” is true. Entering the trigger volume sets isPlayerInVolume to true and nothing else. Exiting the trigger volume sets isPlayerInVolume to false, checks to see if isOpen true and if it is, waits 3 seconds then closes the door.

Now all the doors seem to work and I’ve not had any odd behaviour. Thanks again!

Glad to have helped!