本文整理汇总了C++中UNavigationSystem::GetRandomPointInNavigableRadius方法的典型用法代码示例。如果您正苦于以下问题:C++ UNavigationSystem::GetRandomPointInNavigableRadius方法的具体用法?C++ UNavigationSystem::GetRandomPointInNavigableRadius怎么用?C++ UNavigationSystem::GetRandomPointInNavigableRadius使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UNavigationSystem
的用法示例。
在下文中一共展示了UNavigationSystem::GetRandomPointInNavigableRadius方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetNewSearchPosition
FVector ABaseController::GetNewSearchPosition()
{
FNavLocation Location;
UNavigationSystem* NavSys = World->GetNavigationSystem();
NavSys->GetRandomPointInNavigableRadius(TargetsLastKnownPosition, Self->SearchRange, Location);
return Location.Location;
}
示例2: GetHitPosition
FVector ABaseController::GetHitPosition()
{
FNavLocation location;
UNavigationSystem* navSys = UNavigationSystem::GetCurrent(World);
navSys->GetRandomPointInNavigableRadius(AttackLocation, 200.f, location);
return location.Location;
}
示例3: GetNewWanderPosition
FVector ABaseController::GetNewWanderPosition()
{
FNavLocation Location;
UNavigationSystem* NavSys = World->GetNavigationSystem();
FHitResult hit(ForceInit);
FCollisionQueryParams traceParams = FCollisionQueryParams(FName(TEXT("RV_Trace")), true, Self);
traceParams.bTraceComplex = true;
traceParams.bTraceAsyncScene = true;
int times = 0;
float minimuimDist = Self->MinimuimDistanceBetweenWanderLocations;
do{
if (times >= 50)
{
times = 0;
minimuimDist -= 500.f;
}
times++;
NavSys->GetRandomPointInNavigableRadius(Self->GetActorLocation(), Self->SightRange, Location);
} while (FVector::Dist(Location.Location, Self->GetActorLocation()) < minimuimDist);
bool bHit = World->LineTraceSingleByChannel(hit, Self->EyeLocation, Location.Location, ECC_Visibility, traceParams);
return Location.Location;
}
示例4: ExecuteTask
EBTNodeResult::Type UATBTTask_MoveArea::ExecuteTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory)
{
UNavigationSystem* NavigationSystem = UNavigationSystem::GetCurrent(GetWorld());
AATCharacterAI* MyCharacter = Cast<AATCharacterAI>(OwnerComp.GetAIOwner()->GetPawn());
if (NavigationSystem != nullptr && MyCharacter != nullptr)
{
FNavLocation RandomPointIn;
if (NavigationSystem->GetRandomPointInNavigableRadius(MyCharacter->GetActorLocation(), MyCharacter->AreaRadius, RandomPointIn))
{
OwnerComp.GetBlackboardComponent()->SetValue<UBlackboardKeyType_Vector>(GetSelectedBlackboardKey(), RandomPointIn.Location);
return EBTNodeResult::Succeeded;
}
}
return EBTNodeResult::Failed;
}