Как исправить идентификатор ошибки "PlayerViewPointLocation" не определено - PullRequest
0 голосов
/ 20 апреля 2019

Я следую учебному пособию https://www.udemy.com/unrealcourse/learn/lecture/4690340?start=150#overview, и оно было сделано до Visual Studio 2015, поэтому я думаю, что мне не хватает включаемого файла, но я не уверен, что или я что-то упускаю.Это функция, в которой ошибка:

#include "Grabber.h"
#include "Gameframework/Actor.h"
#include "DrawDebugHelpers.h"


#define OUT


// Called every frame
void UGrabber::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
    Super::TickComponent(DeltaTime, TickType, ThisTickFunction);

    // get player view point this tick
    FVector PlayerViewpointLocation;
    FRotator PlayerViewPointRotation;
    GetWorld()->GetFirstPlayerController()->GetPlayerViewPoint(
        OUT PlayerViewpointLocation,
        OUT PlayerViewPointRotation
    );

    //logout to test
    /*UE_LOG(LogTemp, Warning, TEXT("Location: %s, Rotation: %s!"), *PlayerViewpointLocation.ToString(), *PlayerViewPointRotation.ToString());*/

    FVector LineTraceEnd = PlayerViewPointLocation /* the error is right here*/ + FVector(0.f, 0.f, 20.f);

    // draw a red trace in the world to visual
    DrawDebugLine(
        GetWorld(),
        PlayerViewpointLocation,
        LineTraceEnd,
        FColor(255, 0, 0),
        false,
        0.f,
        0.f,
        10.f
        );

    // ray cast out to reach distance

    //see what we hit
}

1 Ответ

0 голосов
/ 20 апреля 2019

С заглавной буквы в декларации

// get player view point this tick
FVector PlayerViewpointLocation;
FRotator PlayerViewPointRotation;
GetWorld()->GetFirstPlayerController()->GetPlayerViewPoint(
    OUT PlayerViewpointLocation,
    OUT PlayerViewPointRotation
);
...