Bug in UInstancedStaticMeshComponent::GetInstancesOverlappingSphere()

I have created a new actor that includes an UInstancedStaticMeshComponent.
In this actor I add one single instanced static mesh in BeginPlay() like this:

FTransform trans;
trans.SetLocation(FVector(ForceInitToZero));
TempInstancedMeshComp->AddInstanceWorldSpace(trans);

Now in the player controller I want to know every time the player hovers the mouse over that instanced static mesh.
I do this with the following code:

FHitResult result(ForceInit);
GetHitResultUnderCursor(ECollisionChannel::ECC_Visibility, true, result);
UPrimitiveComponent* comp = result.GetComponent();
if (comp && comp->GetName() == "InstancedMeshes")   // Name of the UInstancedStaticMeshComponent
{
    UInstancedStaticMeshComponent* meshComp = Cast<UInstancedStaticMeshComponent>(comp);
    if (meshComp)
    {
        DrawDebugSphere(GetWorld(), result.Location, 2.0f, 25, FColor::Orange);
        TArray<int32> instances = meshComp->GetInstancesOverlappingSphere(result.Location, 0.0001f, true);
        if (instances.Num() > 0)
        {
            GEngine->AddOnScreenDebugMessage(-1, 0.1f, FColor::Yellow, FString::Printf(
                TEXT("%d (of %d) at loc. %s"), instances[0], instances.Num(), *result.Location.ToString()));
        }
    }
}

This code adds a small debug sphere to the location under the cursor when it hovers over the instanced mesh.
And it also prints out which mesh index it is:

299678-screenshot-ok.png

299679-screenshot-ok2.png

However, this does not always work. In my simple example it seems to work only when the cursor is over the lower half of the cube. But whenever I move the cursor upwards, even though it is sitll over the cube, my code does not recognize this:

299680-screenshot-error.png

299691-screenshot-error2.png

Note the small debug sphere which is correcly rendered under the cursor on the cube, but nothing is printed.
So the call to GetInstancesOverlappingSphere() does not return the correct mesh instance in all cases.

Any ideas what I am doing wrong here?
Or is this even a bug in the UE4 code?

Hello,

We’ve recently made a switch to a new bug reporting method using a more structured form. Please visit the link below for more details and report the issue using the new Bug Submission Form. Feel free to continue to use this thread for community discussion around the issue.

https://epicsupport.force.com/unrealengine/s/

Thanks

Thanks, I have filed a bug report, including a small demo project.