这个宏有什么问题?
Whats wrong with this macro?
我不知道记录玩家视角的宏有什么问题。据我所知,我一定是遗漏了一个 "include what you use" 散列,但我不知道它是什么。我已经尝试了我能想到的一切,疯狂地用谷歌搜索,可能与从 FRotator 和 Vectors 到宏输出到控制台的转换有关。
// Copyright Josh Marino 2017
#include "Grabber.h"
#include "PositionReport.generated.h"
#include "CoreMinimal.h"
#include "Engine/World.h"
// 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 reporting for Duty!"))
}
// Called every frame
void UGrabber::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
// Get Player viewpoint viewpoint
FVector PlayerViewPointLocation;
FRotator PlayerViewPointRotation;
GetWorld()->GetFirstPlayerController()->GetPlayerViewPoint(
PlayerViewPointLocation,
PlayerViewPointRotation
);
// Log Out To Test
UE_LOG(LogTemp, Warning, TEXT("Location: %s Position: %s") *PlayerViewPointLocation.ToString(), *PlayerViewPointRotation.ToString())
// Ray-Cast out to reach distance
// See what we hit
}
出于某种原因它现在可以工作了........宏是愚蠢的
#include "Grabber.h"
#include "PositionReport.generated.h"
#include "CoreMinimal.h"
#include "Engine/World.h"
// 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.
bWantsBeginPlay = true;
PrimaryComponentTick.bCanEverTick = true;
// ...
}
// Called when the game starts
void UGrabber::BeginPlay()
{
Super::BeginPlay();
UE_LOG(LogTemp, Warning, TEXT("Grabber reporting 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 PlayerViewPointLocation;
FRotator PlayerViewPointRotation;
GetWorld()->GetFirstPlayerController()->GetPlayerViewPoint(
OUT PlayerViewPointLocation,
OUT PlayerViewPointRotation
);
// TODO Log out to test
UE_LOG(LogTemp, Warning, TEXT("Location: %s, Rotation: %s"),
*PlayerViewPointLocation.ToString(),
*PlayerViewPointRotation.ToString()
)
// Ray-cast out to reach distance
// See what what we hit
}
我不知道记录玩家视角的宏有什么问题。据我所知,我一定是遗漏了一个 "include what you use" 散列,但我不知道它是什么。我已经尝试了我能想到的一切,疯狂地用谷歌搜索,可能与从 FRotator 和 Vectors 到宏输出到控制台的转换有关。
// Copyright Josh Marino 2017
#include "Grabber.h"
#include "PositionReport.generated.h"
#include "CoreMinimal.h"
#include "Engine/World.h"
// 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 reporting for Duty!"))
}
// Called every frame
void UGrabber::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
// Get Player viewpoint viewpoint
FVector PlayerViewPointLocation;
FRotator PlayerViewPointRotation;
GetWorld()->GetFirstPlayerController()->GetPlayerViewPoint(
PlayerViewPointLocation,
PlayerViewPointRotation
);
// Log Out To Test
UE_LOG(LogTemp, Warning, TEXT("Location: %s Position: %s") *PlayerViewPointLocation.ToString(), *PlayerViewPointRotation.ToString())
// Ray-Cast out to reach distance
// See what we hit
}
出于某种原因它现在可以工作了........宏是愚蠢的
#include "Grabber.h"
#include "PositionReport.generated.h"
#include "CoreMinimal.h"
#include "Engine/World.h"
// 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.
bWantsBeginPlay = true;
PrimaryComponentTick.bCanEverTick = true;
// ...
}
// Called when the game starts
void UGrabber::BeginPlay()
{
Super::BeginPlay();
UE_LOG(LogTemp, Warning, TEXT("Grabber reporting 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 PlayerViewPointLocation;
FRotator PlayerViewPointRotation;
GetWorld()->GetFirstPlayerController()->GetPlayerViewPoint(
OUT PlayerViewPointLocation,
OUT PlayerViewPointRotation
);
// TODO Log out to test
UE_LOG(LogTemp, Warning, TEXT("Location: %s, Rotation: %s"),
*PlayerViewPointLocation.ToString(),
*PlayerViewPointRotation.ToString()
)
// Ray-cast out to reach distance
// See what what we hit
}