I'm developing a mortar for a game and I have to get the facing direction of the mortar when it's placed on a surface with a variable normal. The mortar orientation needs to be in the direction of the player that player is facing, but needs to maintain the up vector of the surface normal.
Player's heading (Z rotation in a Z-up world)
If I'm not making sense, I need the forward vector of the mortar when placed on the ground! :D