But I found it quite compliated because I have to deal with four directions for each side. I am wondering whether there is any classical way to deal with this problem.
add inputs, and this blueprint code.