trying to draw this line from a widget where the end point follows an actor on screen as the player/camera moves.
I Think ive gotten pretty close by trial and error so far and a lot of research.
Its updating as the player moves around but its off by quite a bit.
What ive got so far-
int32 UCodeEditor::NativePaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const
{
if (!OwningInteractable)
{
UE_LOG(LogTemp, Warning, TEXT("Code Editor has no owning interactable"));
return LayerId;
}
FVector2D InteractableLocation;
UGameplayStatics::ProjectWorldToScreen(
GetWorld()->GetFirstPlayerController(),
OwningInteractable->GetActorLocation(),
InteractableLocation
);
FVector2D ScreenEnd = TextInput->GetCachedGeometry().AbsoluteToLocal(InteractableLocation);
FPaintContext Context(AllottedGeometry, MyCullingRect, OutDrawElements, LayerId, InWidgetStyle, bParentEnabled);
FVector2D ScreenStart = TextInput->GetCachedGeometry().GetLocalPositionAtCoordinates(FVector2D(1.f, 0.f));
UWidgetBlueprintLibrary::DrawLine(Context, ScreenStart, InteractableLocation, FLinearColor::Yellow, true, 2.0f);
return LayerId;
}