How to change Decal's rotation at runtime relative to the floor or wall? C++

So you are using the if statement to prevent the calculation from becoming unstable before building a matrix with the X and Z axis.
Using this function:

FMatrix rotation = FRotationMatrix::MakeFromZX(impactNormal, basis);