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 can i get and use Contexts in custom EQS Generator in C++?

Hi i have created a custom eqs generator based on my needs and now i want to generate some points based on a custom context created in BP.

here is my .h file:

 class MYGAME_API UEQGenerator_Test: public UEnvQueryGenerator_ProjectedPoints
 {
     GENERATED_BODY()
     UPROPERTY(EditAnywhere, Category = Generator)
         TSubclassOf<class UEnvQueryContext> Center;
 
         UPROPERTY(EditAnywhere, Category = Generator)
             TSubclassOf<class UEnvQueryContext> MyContext;
     virtual void GenerateItems(FEnvQueryInstance& QueryInstance) const override;
 private:
     mutable FEnvQueryInstance* CachedQueryInstanceQuerier;
 };

i've done this so far for "Center" context that is querier:

 void UEQGenerator_Test::GenerateItems(FEnvQueryInstance& QueryInstance) const
 {
         TArray<FVector> CenterPoints;
         QueryInstance.PrepareContext(Center, CenterPoints);
         CachedQueryInstanceQuerier = &QueryInstance;
         check(CachedQueryInstanceQuerier);
         const FVector QuerierLoc = Cast<AActor>(CachedQueryInstanceQuerier->Owner.Get())->GetActorLocation();
 }

and how can i get details of this context("MyContext") in code? e.g its location and rotation? what should i do?

Product Version: UE 4.9
Tags:
more ▼

asked Oct 28 '15 at 11:24 AM in C++ Programming

avatar image

absali
11 1 3 6

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

1 answer: sort voted first

ok, i found the answer:

     TArray<AActor*> MyContextActors;
     if (!QueryInstance.PrepareContext(MyContext, MyContextActors))
     {
         return;
     }
     
     for (int32 ContextIndex = 0; ContextIndex < MyContextActors.Num(); ContextIndex++)
     {
         UE_LOG(LogTemp, Warning, TEXT("MyContext Loc is %s"), *MyContextActors[ContextIndex]->GetActorLocation().ToString());
     }

just get the first number of the array in case of using one actor

 MyContextActors[0]
more ▼

answered Oct 30 '15 at 04:27 PM

avatar image

absali
11 1 3 6

(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