Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to run EQS in C++
#include "MyAIController.h"
#include "EnvironmentQuery/EnvQueryManager.h"
void AMyAIController::FindHidingSpot()
{
FEnvQueryRequest HidingSpotQueryRequest = FEnvQueryRequest(FindHidingSpotEQS, this);
HidingSpotQueryRequest.Execute(EEnvQueryRunMode::SingleResult, this, &AMyAIController::MoveToQueryResult);
}
void AMyAIController::MoveToQueryResult(TSharedPtr<FEnvQueryResult> result)
{
if (result->IsSuccsessful()) {
MoveToLocation(result->GetItemAsLocation(0));
}
}
#include "CoreMinimal.h"
#include "AIController.h"
#include "EnvironmentQuery/EnvQueryTypes.h"
#include "MyAIController.generated.h"
class UEnvQuery;
UCLASS()
class EQSTUTORIAL_API AMyAIController : public AAIController
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, Category = "AI")
UEnvQuery *FindHidingSpotEQS;
UFUNCTION(BlueprintCallable)
void FindHidingSpot();
void MoveToQueryResult(TSharedPtr<FEnvQueryResult> result);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.