Add extra checking in TaskInWithinRange
This commit is contained in:
parent
bab1f8acd6
commit
6cae297c3a
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue