Hey all,
I’m working on creating a custom static mesh component that I want to always face the active camera. I’ve got it working while playing, but I would also like it to work in the editor preview before you hit run. Unfortunately, the path I’m currently using to grab the camera doesn’t seem to work in preview mode. Here’s the code in my TickComponent function that works while playing the game:
if (GEngine && GetWorld()->WorldType != EWorldType::EditorPreview)
{
auto pController = GEngine->GetFirstLocalPlayerController(GetWorld());
if (pController && pController->PlayerCameraManager)
{
auto cameraRotation = pController->PlayerCameraManager->GetCameraRotation();
SetWorldRotation(cameraRotation);
}
}
So if I can get the rotation of the Editor Preview Window, I should be able to get it to work there too. Thanks!
EDIT: Also note that the bAbsoluteRotation = true