This is my header
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "FPS_Character.generated.h"
class UCameraComponent;
UCLASS()
class BASIC_SHOOTER_01_API AFPS_Character : public ACharacter
{
GENERATED_BODY()
public:
// Sets default values for this character's properties
AFPS_Character();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
// Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
private:
bool isTouchingGround = false;
private:
UCameraComponent* ptrCamera = nullptr;
private:
void Jump();
UFUNCTION()
void OnCollisionEnter
(
const FOverlapInfo& OtherOverlap,
bool bDoNotifies
);
UFUNCTION()
void OnCollisionExit
(
const FOverlapInfo& OtherOverlap,
bool bDoNotifies,
bool bSkipNotifySelf
);
};
This is my CPP file
// Fill out your copyright notice in the Description page of Project Settings.
#include "FPS_Character.h"
#include "Camera/CameraComponent.h"
#include "Engine.h"
#include "Components/CapsuleComponent.h"
// Sets default values
AFPS_Character::AFPS_Character() :
ptrCamera { CreateDefaultSubobject<UCameraComponent>(TEXT("FPS_camera")) }
{
// Set this character to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
ptrCamera->SetupAttachment(this->GetCapsuleComponent());
ptrCamera->RelativeLocation = FVector(-39.56f, 1.75f, 64.f);
this->GetCapsuleComponent()->BeginComponentOverlap.AddDynamic(this, &AFPS_Character::OnCollisionExit);
this->GetCapsuleComponent()->EndComponentOverlap.AddDynamic(this, &AFPS_Character::OnCollisionEnter);
}
// Called when the game starts or when spawned
void AFPS_Character::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void AFPS_Character::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
// Called to bind functionality to input
void AFPS_Character::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
}
void AFPS_Character::Jump()
{
}
void AFPS_Character::OnCollisionEnter
(
const FOverlapInfo& OtherOverlap,
bool bDoNotifies
)
{
if (OtherOverlap.OverlapInfo.GetActor() != this)
{
GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Green, FString::Printf(TEXT("You collided with: %s"), OtherOverlap.OverlapInfo.GetActor()->GetName()));
}
}
void AFPS_Character::OnCollisionExit
(
const FOverlapInfo& OtherOverlap,
bool bDoNotifies,
bool bSkipNotifySelf
)
{
if (OtherOverlap.OverlapInfo.GetActor() != this)
{
GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Green, FString::Printf(TEXT("You uncollided with: %s"), OtherOverlap.OverlapInfo.GetActor()->GetName()));
}
}
When I compile it says: “Unrecognized type ‘FOverlapInfo’ - type must be a UCLASS, USTRUCT or UENUM”.
How can I fix this?