I'm trying to correctly position a decal on a surface, that can be oriented in any direction. The decal is constantly repositioned, so I'm not attaching it to any component. Instead, I trace a line from the camera and want to place the decal at the hit location. The position is no problem, since I get the hit location from the line trace. I'm having some issue with calculating the correct rotation though.
Of course I get the hit normal, which I can use:
But as far as I can tell, a vector alone does not define a rotation completely, as you could still rotate the decal around the normal vector. I'd like the decal to always have the same rotation, relative to the surface, i.e. if I would rotate the surface around the hit normal, I want the decal to rotate with it, as if it was glued to the surface.
Of course I get the hit normal, which I can use:
Code:
FRotator SpawnRotation = Hit.Normal.Rotation();
Comment