for some reason this function works with offset and does not give me real values; the sight should be exactly on the sphere or, in extreme cases, its upper left edge should be in the middle of the sphere, but the sight goes somewhere down to the right
here video of bug and function that im using
void UWidgetDuelShooterFunctionLibrary::MoveWidget(APlayerController* Owner, FRotator NewWidgetLocation, UWidget* Widget)
{
if (!Owner)
return;
// Convert rotator for forward vector function
NewWidgetLocation = { NewWidgetLocation.Yaw, NewWidgetLocation.Pitch, 0 };
FVector2D NewOffset;
auto DoesWork = UWidgetLayoutLibrary::ProjectWorldLocationToWidgetPosition(/*UKismetMathLibrary::GetForwardVector(NewWidgetLocation)*/Owner,FVector(492.5f,0,87), NewOffset,false);
UE_LOG(LogTemp, Error, TEXT("Does work: %i NewOffset: %s "), int(DoesWork), *NewOffset.ToString());
UWidgetDuelShooterFunctionLibrary::MoveWidget(NewOffset, Widget);
}