ConvertWorldLocationToScreenLocation has exponential growth of X value.

It appears that ConvertWorldLocationToScreenLocation is behaving incorrectly. In this example I am having an arrow point to an actor that is off screen. The arrow is positioned around the screen to show you what direction you need to scroll (in this case it’s down and right). This should place the arrow in the bottom right of the screen. However when I convert the location to the screen location the X value of the screen location goes crazy and grows exponentially when I scroll vertically. When it gets too big, the node return false and results in the arrow being placed in the top left corner.

To get this effect, I use the ConvertWorldLocationToScreenLocation node and use a lerp to determine what part of the screen it should be on. I lerp X and Y individually to determine the position of the arrow widget. This is the logic behind it. Note I do make sure to scale it based on the Screen DPI. I’ve tried this with the location to widget position node as well and it also results in the same crazy numbers for such little movement.

It looks like it’s simply saying that this position can not be project to screen space for some reason (probably reaching the limit of floats) and failing out. What I can’t figure out is why the numbers are jumping so much at this distance.

I’m still looking into this and have determined that the part that is failing is inside SceneView.cpp

bool FSceneView::ProjectWorldToScreen(const FVector& WorldPosition, const FIntRect& ViewRect, const FMatrix& ViewProjectionMatrix, FVector2D& out_ScreenPos)
{
        FPlane Result = ViewProjectionMatrix.TransformFVector4(FVector4(WorldPosition, 1.f));
        if ( Result.W > 0.0f )
    	{
        ...
        }
    return false;
}

It seems that Result is blank even though my World position is (1816.46545, 7144.05957, 272.999146). I’ll keep digging!

EDIT: It seems that I can’t go much further along this route. TransformFVector4 is a FORCEINLINE function and I don’t really know how to debug that. Any suggestions?

The general conciseness from unreal slackers is that this is happening because the vector is moving behind the cameras plane. that’s why it’s failing out.