Skip to content

Instantly share code, notes, and snippets.

@Tesladev2323

Tesladev2323/PlayerCamera.cpp Secret

Created Aug 23, 2018
Embed
What would you like to do?
[End Result] Classic Camera C++ - PlayerCamera.cpp
// Fill out your copyright notice in the Description page of Project Settings.
#include "PlayerCamera.h"
#include "Kismet/GameplayStatics.h"
#include "Camera/CameraComponent.h"
// Constructor
APlayerCamera::APlayerCamera()
{
GetCameraComponent()->SetAspectRatio(2.35);
GetCameraComponent()->SetFieldOfView(75.0f);
}
// Begin Play
void APlayerCamera::BeginPlay()
{
if (StartingCamera)
{
APlayerController* PlayerController = UGameplayStatics::GetPlayerController(GetWorld(), 0);
if (PlayerController)
{
FViewTargetTransitionParams TransitionParams;
PlayerController->SetViewTarget(this, TransitionParams);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment