Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

AI Character no longer moving.

So It was all fine and dandy, my AI was moving where I told it to on the nav mesh when I pressed play. But now, every time I press play my character just stands there and does nothing. I seemingly didn't change anything or do anything that would cause this sudden change of behavior. My character's AI Controller Class is set properly and I know for sure that Move to Actor gets called as I put a break point on it (Not in this screen grab, but I did). This is the blueprint alt text

And Here is my class PWAICharacter which is derived from AICharacter:


 #pragma once
 #include "Perception/AISense.h"
 #include "Perception/AISenseConfig_Sight.h"
 #include "Perception/AIPerceptionComponent.h"
 #include "AIController.h"
 #include "PWAIController.generated.h"
 class PW_GAME_API APWAIController : public AAIController
     APWAIController(const FObjectInitializer& ObjectInitializer);
     UAISenseConfig_Sight* sightConfig;
     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "AI")
     float agroRange = 50;
     UFUNCTION(Category = "Perception")
     void SenseUpdated(TArray<AActor*> testActors);


 APWAIController::APWAIController(const FObjectInitializer& ObjectInitializer)
     :Super(ObjectInitializer.SetDefaultSubobjectClass<UPWPathFollowingComponent>(TEXT("PW PathFollowingComponent")))
     PerceptionComponent = CreateDefaultSubobject<UAIPerceptionComponent>(TEXT("Perception Component"));
     sightConfig = CreateDefaultSubobject<UAISenseConfig_Sight>(TEXT("Sight Config"));
     sightConfig->SightRadius = agroRange;
     sightConfig->LoseSightRadius = agroRange + 50;
     sightConfig->DetectionByAffiliation.bDetectEnemies = true;
     sightConfig->DetectionByAffiliation.bDetectNeutrals = true;
     sightConfig->DetectionByAffiliation.bDetectFriendlies = true;
     PerceptionComponent->OnPerceptionUpdated.AddDynamic(this, &APWAIController::SenseUpdated);
 void APWAIController::SenseUpdated(TArray<AActor*> Actors)
     GEngine->AddOnScreenDebugMessage(-1, 10, FColor::Blue, "Perception Sense Updated");

Also if it makes a difference here is my PWPathFollowingComponent class:

 UPWPathFollowingComponent::UPWPathFollowingComponent(const FObjectInitializer& ObjectInitializer)
     : Super(ObjectInitializer)
 void UPWPathFollowingComponent::SetMoveSegment(int32 SegmentStartIndex)
     const uint16 AreaFlags = FNavMeshNodeFlags(Path->GetPathPoints()[SegmentStartIndex].Flags).AreaFlags;
     const uint16 JumpFlag = uint16(1 << UNavArea_Jump::AI_Path_Choice::Jump);
     FString checkAreaFlags = FString::FromInt(AreaFlags);
     FString checkJumpFlag = FString::FromInt(JumpFlag);
     GEngine->AddOnScreenDebugMessage(-1, 1, FColor::Red, checkAreaFlags + " / " + checkJumpFlag);
     if ((AreaFlags & JumpFlag) != 0)
         //Jumping code for path finding
         GEngine->AddOnScreenDebugMessage(-1, 1, FColor::Red, "AI Found Jumping PathNode");

Product Version: UE 4.8
error.png (145.4 kB)
more ▼

asked Jul 10 '15 at 02:18 AM in C++ Programming

avatar image

56 8 9 15

(comments are locked)
10|2000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question