i’ve included “Engine/World.h” header file to use () and i am able to access GetFirstPlayerController()(one of its member) but i couldn’t access GetPawn()(member of GetFirstPlayerController())…intellisense shows no member available…pls tell me what files to include??.
#include “OpenDoor.h”
#include “GameFramework/Actor.h”
#include “Engine/World.h”
// Sets default values for this component's properties
UOpenDoor::UOpenDoor()
{
// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features
// off to improve performance if you don't need them.
PrimaryComponentTick.bCanEverTick = true;
// ...
}
// Called when the game starts
void UOpenDoor::BeginPlay()
{
Super::BeginPlay();
()->GetFirstPlayerController()
}
void UOpenDoor::OpenDoor()
{
AActor*Owner = GetOwner();
FRotator Rotation = FRotator(0.f, -60.f, 0.f);
Owner->SetActorRotation(Rotation);
}
// Called every frame
void UOpenDoor::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
// If the ActorThatOpens is in the triggervolume
// then open the door
if (PressurePlate->IsOverlappingActor(ActorThatOpens))
{
OpenDoor();
}
}