x

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"

How to fine-tune DetourCrowdContoller

Hello, although I have been reading as much as I could find about the DetourCrowdController class I still dont really understand how to fine-tune its behavior.

This is what I have so far:

Header

 UCLASS()
 class CROWD_API AMyAIController : public AAIController, public ICrowdAgentInterface
 {
     GENERATED_BODY()
 public:
 
     UPROPERTY(EditDefaultsOnly, Category = "AI")
     FName LocationToGoKey;
 
     virtual void Possess(APawn* Pawn) override;
 
     AMyAIController(const FObjectInitializer& ObjectInitializer);
 
     FORCEINLINE UBlackboardComponent* GetBlackboardComp() const { return BlackboardComp; }
     FORCEINLINE TArray<AActor*> GetAvailableTargetPoints() { return BotTargetPoints; }
 protected:
     UBehaviorTreeComponent* BehaviorComp;
     UBlackboardComponent* BlackboardComp;
     UCrowdFollowingComponent* CrowdComp;
     TArray<AActor*> BotTargetPoints;
 };

cpp

 AMyAIController::AMyAIController(const FObjectInitializer& ObjectInitializer)
     : Super(ObjectInitializer.SetDefaultSubobjectClass<UCrowdFollowingComponent>(TEXT("PathFollowingComponent")))  //UPathFollowingComponent
 {
     UE_LOG(LogTemp, Warning, TEXT("DETOUR"));
     CrowdComp = CreateDefaultSubobject<UCrowdFollowingComponent>(TEXT("CrowdComp"));
     UCrowdManager* CrowdManager = UCrowdManager::GetCurrent(this); 
     if (CrowdManager) { 
         CrowdManager->RegisterAgent(this);
 
     }
     CrowdComp->SetAcceptanceRadius(500.f);
     LocationToGoKey = "LocationToGo";
   }
 
 void AMyAIController::Possess(APawn* Pawn)
 {
     Super::Possess(Pawn);
            CrowdComp->SetCrowdAvoidanceQuality(ECrowdAvoidanceQuality::High);           
         CrowdComp->SetCrowdCollisionQueryRange(800.f, true);
         CrowdComp->SetCrowdSeparationWeight(4.f, true);
         float QueryRange = CrowdComp->GetCrowdCollisionQueryRange();
         float SeperationWeight = CrowdComp->GetCrowdSeparationWeight();

             // enabling this line or not makes no visible difference 
         //CrowdComp->SetCrowdSeparation(true, true); 
     
 
         bool SepActive = CrowdComp->IsCrowdSeparationActive();
         bool SepEnable = CrowdComp->IsCrowdSeparationEnabled();
 
         UE_LOG(LogTemp, Warning, TEXT("QueryRange: %f"), QueryRange);
         UE_LOG(LogTemp, Warning, TEXT("SepWeight: %f"), SeperationWeight);
         UE_LOG(LogTemp, Warning, TEXT("Active: %i"), SepActive);
         UE_LOG(LogTemp, Warning, TEXT("Enabled: %i"), SepEnable);
 
     }
 }

As visible from the picture below although my AI pawns are avoiding each other they move equally unrealistic; only that before they ran into each other whereas now they "moonwalk" sideways and sort of shift around the way points.

What I additionally found strange is that even due I doubled and the values suggested in this post: https://answers.unrealengine.com/questions/145930/detour-avoidance-groups.html

I do not witness any visible change in behavior.

Is there away of making the AI move without sliding around in such a messy way?

alt text

Product Version: UE 4.14
Tags:
waypoint.png (194.3 kB)
more ▼

asked Feb 14 '17 at 09:27 AM in C++ Programming

avatar image

hagoicrc
21 2 3 5

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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