Hello everybody,
I have a big problem, i try access this Function in my AIController Class like this:
Base_AI_Controller.h:
#include "AIController.h"
#include "Base_AI_Controller.generated.h"
UCLASS()
class BEEFENDER_API ABase_AI_Controller : public AAIController
{
GENERATED_BODY()
ABase_AI_Controller();
class UAIPerceptionComponent* AIPerceptionComp;
class UAISenseConfig_Sight* Sight;
class UAISenseConfig_Hearing* Hear;
UFUNCTION()
void OnTargetPerceptionUpdated(AActor* SensedActor, FAIStimulus Stimulus);
};
Base_AI_Controller.cpp:
#include "Perception/AIPerceptionComponent.h"
#include "Perception/AISenseConfig_Sight.h"
#include "Perception/AISenseConfig_Hearing.h"
#include "Base_AI_Controller.h"
ABase_AI_Controller::ABase_AI_Controller()
{
AIPerceptionComp = CreateDefaultSubobject<UAIPerceptionComponent>(TEXT("AIPerceptionComp"));
Sight = CreateDefaultSubobject<UAISenseConfig_Sight>(TEXT("Sigth Config"));
Sight->SightRadius = 400;
Sight->LoseSightRadius = 600;
Sight->PeripheralVisionAngleDegrees = 180;
Sight->DetectionByAffiliation.bDetectEnemies = true;
Sight->DetectionByAffiliation.bDetectFriendlies = true;
Sight->DetectionByAffiliation.bDetectNeutrals = true;
Sight->SetMaxAge(5);
AIPerceptionComp->ConfigureSense(*Sight);
Hear = CreateDefaultSubobject<UAISenseConfig_Hearing>(TEXT("Hearing Config"));
Hear->HearingRange = 1000;
Hear->DetectionByAffiliation.bDetectEnemies = true;
Hear->DetectionByAffiliation.bDetectFriendlies = true;
Hear->DetectionByAffiliation.bDetectNeutrals = true;
AIPerceptionComp->ConfigureSense(*Hear);
AIPerceptionComp->OnTargetPerceptionUpdated.AddDynamic(this, &ABase_AI_Controller::OnTargetPerceptionUpdated);
}
void ABase_AI_Controller::OnTargetPerceptionUpdated(AActor* SensedActor, FAIStimulus Stimulus)
{
UE_LOG(LogTemp, Warning, TEXT("Hab was"));
}
when i do this, i get this errors:
Error C2079 āZ_Param_Stimulusā uses undefined struct āFAIStimulusā Beefender D:\UE4 Projects\Beefender\Source\Beefender\AI\Base_AI_Controller.h 14
Error C2664 āvoid ABase_AI_Controller::OnTargetPerceptionUpdated(AActor *,FAIStimulus)ā: cannot convert argument 2 from āintā to āFAIStimulusā Beefender D:\UE4 Projects\Beefender\Source\Beefender\AI\Base_AI_Controller.h 14
Error C2079 āZ_Construct_UFunction_ABase_AI_Controller_OnTargetPerceptionUpdated::Base_AI_Controller_eventOnTargetPerceptionUpdated_Parms::Stimulusā uses undefined struct āFAIStimulusā Beefender D:\UE4 Projects\Beefender\Intermediate\Build\Win64\UE4Editor\Inc\Beefender\Beefender.generated.cpp 228
I hope you can help me with this
Sorry for my bad english