Add extra checking in TaskInWithinRange

This commit is contained in:
baz 2023-10-22 22:13:35 +01:00
parent bab1f8acd6
commit 6cae297c3a
1 changed files with 2 additions and 2 deletions

View File

@ -17,10 +17,10 @@ EBTNodeResult::Type UTaskIsWithinRange::ExecuteTask(UBehaviorTreeComponent& owne
auto NavigationSystem = FNavigationSystem::GetCurrent<UNavigationSystemV1>(GetWorld()); auto NavigationSystem = FNavigationSystem::GetCurrent<UNavigationSystemV1>(GetWorld());
FVector SourceLocation = BlackboardComponent->GetValueAsVector(SourceLocationKey.SelectedKeyName); FVector SourceLocation = BlackboardComponent->GetValueAsVector(SourceLocationKey.SelectedKeyName);
ANakatomiCharacter* selfActor = Cast<ANakatomiCharacter>( auto selfActor = Cast<ANakatomiCharacter>(
BlackboardComponent->GetValueAsObject(SelfActorKey.SelectedKeyName)); BlackboardComponent->GetValueAsObject(SelfActorKey.SelectedKeyName));
if (NavigationSystem && SourceLocation != FVector::ZeroVector) if (selfActor && NavigationSystem && SourceLocation != FVector::ZeroVector)
{ {
double Distance = -1.0; double Distance = -1.0;
FNavLocation NavLocation; FNavLocation NavLocation;