-
Notifications
You must be signed in to change notification settings - Fork 221
Expand file tree
/
Copy pathSetViewTarget.cpp
More file actions
28 lines (23 loc) · 813 Bytes
/
SetViewTarget.cpp
File metadata and controls
28 lines (23 loc) · 813 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
// Harrison McGuire
// UE4 Version 4.20.2
// https://github.com/Harrison1/unrealcpp
// https://severallevels.io
// https://harrisonmcguire.com
#include "SetViewTarget.h"
// include gameplay statics header file
#include "Kismet/GameplayStatics.h"
// Sets default values
ASetViewTarget::ASetViewTarget()
{
// 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 when the game starts or when spawned
void ASetViewTarget::BeginPlay()
{
Super::BeginPlay();
//Find the actor that handles control for the local player.
APlayerController* OurPlayerController = UGameplayStatics::GetPlayerController(this, 0);
//Cut instantly to our actor on begin play.
OurPlayerController->SetViewTarget(MyActor);
}