forked from Harrison1/unrealcpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFindPlayerPosition.cpp
More file actions
30 lines (24 loc) · 816 Bytes
/
FindPlayerPosition.cpp
File metadata and controls
30 lines (24 loc) · 816 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Harrison McGuire
// UE4 Version 4.20.2
// https://github.com/Harrison1/unrealcpp
// https://severallevels.io
// https://harrisonmcguire.com
#include "FindPlayerPosition.h"
// Sets default values
AFindPlayerPosition::AFindPlayerPosition()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
}
// Called every frame
void AFindPlayerPosition::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
// get first player pawn location
FVector MyCharacter = GetWorld()->GetFirstPlayerController()->GetPawn()->GetActorLocation();
// screen log player location
if(GEngine)
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green, FString::Printf(TEXT("Player Location: %s"), *MyCharacter.ToString()));
}
}