我想用编辑器点击物体的方式做鼠标点击,查了下引擎里是调了HHitProxy* FViewport::GetHitProxy(int32 X,int32 Y)这个函数,但我直接用好像不对
AActor* UVictoryBPFunctionLibrary::GetViewportHit(const APlayerController * ThePC,int X, int Y) {
if (!ThePC) return nullptr; FViewport * VictoryViewport = ThePC->GetWorld()->GetGameViewport()->Viewport; if (!VictoryViewport) return nullptr; VictoryViewport->InvalidateHitProxy(); HHitProxy* HitProxy = VictoryViewport->GetHitProxy(X, Y); HActor* ActorHitProxy = (HActor*)HitProxy; if (!ActorHitProxy) return nullptr; AActor* ConsideredActor = ActorHitProxy->Actor; return ConsideredActor; } 函数在这,返回很奇葩 蓝图里打印一直是“Brush1”,而不是空的
|