Created
May 20, 2019 19:10
-
-
Save ariok/4cd10a8b87ce8109b56d9ad7736d17d3 to your computer and use it in GitHub Desktop.
How to run EQS in C++
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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)); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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