The display position of the text in DrawDebugString is affected by the scale of the display.
Should refer to the Project() of DebugCanvas (not Canvas).
- Suggest Code
void AHUD::DrawDebugTextList() { // ... // don't draw text behind the camera if ( ((WorldTextLoc - CameraLoc) | CameraRot.Vector()) > 0.f ) { // Project with DebugCanvas // FVector ScreenLoc = Canvas->Project(WorldTextLoc); FVector ScreenLoc = DebugCanvas->Project(WorldTextLoc); TextItem.SetColor( DebugTextList[Idx].TextColor ); TextItem.Text = FText::FromString( DebugTextList[Idx].DebugText ); TextItem.Scale = FVector2D( DebugTextList[Idx].FontScale, DebugTextList[Idx].FontScale); DebugCanvas->DrawItem( TextItem, FVector2D( FMath::CeilToFloat(ScreenLoc.X), FMath::CeilToFloat(ScreenLoc.Y) ) ); } // ... }
Result:
The debug text is displayed in a location away from the Actor.
Expected:
The debug text is displayed in the Actor's location.
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-99709 in the post.
0 |
Fix Commit | 14329579 |
---|---|
Release Commit | 14329579 |
Created | Sep 16, 2020 |
---|---|
Resolved | Sep 16, 2020 |
Updated | Apr 28, 2021 |