Hello,
I’m trying to draw in game a spline and it’s control point to do something close to what is done in editor by FSplineComponentVisualizer.
My issue is that I get always a nullptr from FViewport::GetHitProxy.
Looking what people asked before here I see that it’s a common issue and nobody was able to reply with some sort of solution.
I’d like to understand what I should implement to get it working.
Anybody can help?
Is it normal that when I look for getting hit proxies from a viewport I get with
FViewport* Viewport = GetWorld()->GetGameViewport()->Viewport;
a Viewport/HitProxyMap/HitProxies that is NULL ?
I’m adding the HitProxies in a
class FSplineIGESceneProxy : public FPrimitiveSceneProxy
{
// …
}
in
void FSplineIGESceneProxy::GetDynamicMeshElements(const TArray& Views, const FSceneViewFamily & ViewFamily, uint32 VisibilityMap, FMeshElementCollector & Collector) const
{
for (int32 ViewIndex = 0; ViewIndex < Views.Num(); ViewIndex++)
{
FPrimitiveDrawInterface* PDI = Collector.GetPDI(ViewIndex);
FVector From = FVector(100, 100, 100);
FVector To = FVector(200, 200, 100);
PDI->SetHitProxy(NULL);
PDI->SetHitProxy(new HIGEFromHitProxy(From));
PDI->DrawPoint(From, FLinearColor(0, 1, 0), 20.f, SDPG_World);
PDI->SetHitProxy(NULL);
PDI->DrawLine(From, To, FLinearColor(1, 0, 0), SDPG_World);
PDI->SetHitProxy(new HIGEToHitProxy(To));
PDI->DrawPoint(To, FLinearColor(0, 0, 1), 20.f, SDPG_World);
PDI->SetHitProxy(NULL);
}
}
that is used by a derived from UPrimitiveComponent