You have to work with NORMAL.
Get Normal by using TRACE or in the moment of a collision with a block.

the code is:
vec_to_angle(my.pan,normal.pan)