class "APlayerController" has no member "GetPlayerViewPoint" in UE4.21.2

I'm in UE4 4.21.2

I'm a total noob for UE4. I'm following along with a tutorial where I need to use the GetPlayerViewPoint method on the PlayerController class, however when I try and call that method, I get a compile time error that says: class "APlayerController" has no member "GetPlayerViewPoint"Which is weird because I get autocomplete in Visual Studio for other methods on that class, but not that particular method, BUT I can see that method in the docs here:

Could it be that my compiler and autocomplete are using a different UE4 version than the docs and tutorial? Anyways, here is my class.

 // Copyright, 2018
#include "BryceEscapeRoomUe4.h"
#include "Grabber.h"
#include "Runtime/Engine/Classes/GameFramework/Actor.h"
#include "Engine/World.h";
#include "GameFramework/PlayerController.h"
#define OUT
// Sets default values for this component's properties
UGrabber::UGrabber()
{ // 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 UGrabber::BeginPlay()
{ Super::BeginPlay(); UE_LOG(LogTemp, Warning, TEXT("Grabber repoting for duty!"));
}
// Called every frame
void UGrabber::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{ Super::TickComponent(DeltaTime, TickType, ThisTickFunction); // get player view point this tick FVector PlayerVeiwPointLocation; FRotator PlayerVeiwPointRotaion; GetWorld()->GetFirstPlayerController()->GetPlayerVeiwPoint( OUT PlayerVeiwPointLocation, OUT PlayerVeiwPointRotaion ); //log out to test //ray cast out to reach distance // see what we hit
}
3

1 Answer

I think this may have been caused by the fact that you have spelled GetPlayerViewPoint as GetPlayerVeiwPoint, which isn't a method that exists in UE4. Hopefully that should fix the problem, although as this is a relatively old question I'm sure you figured that out a while ago!

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like