How to constrain my player character to only move at 45 degree angles?

Can you show how you do your movement? Otherwise we can only guess.