Aligning actor to ImpactNormal

Hi all,

I’m having an issue aligning my actor correctly to another actor. I’ve had this issue for a while now but have been putting it off haha. So here are some screenshots of my alignment issue:

At certain angles the actor doesn’t align as it should:

This is good:

And this is bad:

My code:

SpawnedBlueCubeGhost->SetActorTransform(HitResult.GetActor()->GetTransform());
										
FVector TempLocation = HitResultLocation;
TempLocation += HitResult.ImpactNormal.Rotation().Vector() * 100.0;
SpawnedBlueCubeGhost->SetActorLocation(TempLocation);

FRotator TempRotation = HitResult.ImpactNormal.Rotation();
TempRotation.Pitch = TempRotation.Pitch + 90.f;
SpawnedBlueCubeGhost->SetActorRotation(TempRotation);

Any help would be great. What am I doing wrong? Am I missing something?

Thanks,
Jon