optimization BP_selectorPoi
This commit is contained in:
parent
150f3e627e
commit
8339202ff4
@ -18,7 +18,8 @@ public class LuckyWorldV2 : ModuleRules
|
||||
"LuckyTextWrite",
|
||||
"SocketIOClient",
|
||||
"VaRest",
|
||||
"SIOJson"
|
||||
"SIOJson",
|
||||
"NavigationSystem"
|
||||
});
|
||||
|
||||
PrivateDependencyModuleNames.AddRange(new string[] { });
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
|
||||
#include "Gameplay/TargetSelector.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
#include "NavigationSystem.h"
|
||||
|
||||
// Sets default values
|
||||
ATargetSelector::ATargetSelector()
|
||||
@ -23,5 +25,25 @@ void ATargetSelector::Tick(float DeltaTime)
|
||||
{
|
||||
Super::Tick(DeltaTime);
|
||||
|
||||
if (bIsTracing)
|
||||
{
|
||||
APlayerController* PlayerController = UGameplayStatics::GetPlayerController(this, 0);
|
||||
if (PlayerController)
|
||||
{
|
||||
FHitResult HitResult;
|
||||
PlayerController->GetHitResultUnderCursorByChannel(ETraceTypeQuery::TraceTypeQuery1, true, HitResult);
|
||||
if (HitResult.bBlockingHit)
|
||||
{
|
||||
UNavigationSystemV1* NavSys = FNavigationSystem::GetCurrent<UNavigationSystemV1>(GetWorld());
|
||||
|
||||
if (NavSys)
|
||||
{
|
||||
FNavLocation NavLocation;
|
||||
NavSys->ProjectPointToNavigation(HitResult.Location, NavLocation);
|
||||
SetActorLocation(NavLocation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user