Problem w/ Decals

Just a note that Decal Components are supposed to be oriented with their local +X axis facing INTO the surface you are projection onto. So you should invert the surface normal before converting it to a rotation or the projection will be backwards.

The difference may not be noticeable for decals without Normal maps, but on decals with normals, they will be inverted. I tend to use a material function to mask my decals from projecting onto backfaces.

If you wanted to be more explicit about the orientation, you can use FRotationMatrix::MakeFrom##, and optionally specify a second vector to determine the additional rotation around the projection axis.

const FRotator DecalWorldRotation = FRotationMatrix::MakeFromX(-ImpactNormal).Rotator();

-OR-

const FRotator DecalWorldRotation = FRotationMatrix::MakeFromXZ(-ImpactNormal, FVector::UpVector).Rotator();
2 Likes