Rotate based on surface?

I think this is a pretty good video that shows what i want, beside the fact that i am using a linetrace from my mouse