Opening doors both ways

A simple dot product should do.

This thread should help you.