martin #21
@ -18,7 +18,8 @@ public class LuckyWorldV2 : ModuleRules
|
|||||||
"LuckyTextWrite",
|
"LuckyTextWrite",
|
||||||
"SocketIOClient",
|
"SocketIOClient",
|
||||||
"VaRest",
|
"VaRest",
|
||||||
"SIOJson"
|
"SIOJson",
|
||||||
|
"NavigationSystem"
|
||||||
});
|
});
|
||||||
|
|
||||||
PrivateDependencyModuleNames.AddRange(new string[] { });
|
PrivateDependencyModuleNames.AddRange(new string[] { });
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "Gameplay/TargetSelector.h"
|
#include "Gameplay/TargetSelector.h"
|
||||||
|
#include "Kismet/GameplayStatics.h"
|
||||||
|
#include "NavigationSystem.h"
|
||||||
|
|
||||||
// Sets default values
|
// Sets default values
|
||||||
ATargetSelector::ATargetSelector()
|
ATargetSelector::ATargetSelector()
|
||||||
@ -23,5 +25,25 @@ void ATargetSelector::Tick(float DeltaTime)
|
|||||||
{
|
{
|
||||||
Super::Tick(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