martin #21

Merged
martinluckyrobots merged 3 commits from martin into main 2025-04-14 05:03:09 +00:00
2 changed files with 24 additions and 1 deletions
Showing only changes of commit 8339202ff4 - Show all commits

View File

@ -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[] { });

View File

@ -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);
}
}
}
}
} }