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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Change defaultQueryFilter implementation (NavMesh)

Hey, I am trying to modify the filter of the navmesh. To do that I've created a custom filter FRecastQueryFilter_Example and a custom navmesh AMyRecastNavMesh and then in the constructor of AMyRecastNavMesh I assign the implementation of the DefaultQueryFilter to my FRecastQueryFilter_Example. Then the DefaultQueryFilter changes.

The problem is that somewhere in the Unreal Code, the DefaultQueryFilter is changed back to the default implementation again, because when I call any other function of my navmesh I can see the value of the DefaultQueryFilter is equal to FRecastQueryFilter instead of FRecastQueryFilter_Example. I've tried doing a search`and debug of the SetFilterImplementation function and of the assignments to the DefaultQueryFilter but didn't find the problem.

Does anyone know where does this change happens and/or how to solve it?


MyRecastNavMesh.h

  class SHOOTERGAME_API FRecastQueryFilter_Example : public INavigationQueryFilterInterface, public dtQueryFilter_Example {
  //...
  };

   UCLASS()
   class SHOOTERGAME_API AMyRecastNavMesh : public ARecastNavMesh
   {
   GENERATED_BODY()

   public:
         FRecastQueryFilter_Example DefaultNavFilter;

         AMyRecastNavMesh(const FObjectInitializer& ObjectInitializer);

         void SetupCustomNavFilter();
    };


MyRecastNavMesh.cpp
 AMyRecastNavMesh::AMyRecastNavMesh(const FObjectInitializer& ObjectInitializer)
     : Super(ObjectInitializer)
 {
     TSharedPtr<const FNavigationQueryFilter> QueryFilterBefore = GetDefaultQueryFilter();

     if (DefaultQueryFilter.IsValid())
     {
         DefaultQueryFilter->SetFilterImplementation(dynamic_cast<const INavigationQueryFilterInterface*>(&DefaultNavFilter));
     }
     TSharedPtr<const FNavigationQueryFilter> QueryFilterAfter = GetDefaultQueryFilter();
 }
Product Version: UE 4.10
Tags:
more ▼

asked Mar 17 '16 at 09:47 AM in C++ Programming

avatar image

mtrebi
348 16 24 27

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

1 answer: sort voted first

Moving the function SetupCustomNavFilter to inside the BeginPlay() solved the problem.

more ▼

answered Apr 21 '16 at 11:06 AM

avatar image

mtrebi
348 16 24 27

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
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