[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/Harrison1/unrealcpp/master/SetViewTarget/SetViewTarget.cpp [Back]  [Original]

// 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);
}

Web Proxy Viewer  |  New URL  |  Original Page