【发布时间】:2019-04-20 04:49:14
【问题描述】:
我正在关注教程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
}
【问题讨论】:
-
PlayerViewPointLocation-- 这没有在您的代码中的任何地方定义。被声明的称为PlayerViewpointLocation。 C++ 是区分大小写的,如果你还不知道的话。 -
哦,谢谢你修好了。
标签: c++ visual-studio-2015 unreal-engine4