Skip to content

Instantly share code, notes, and snippets.

@Tesladev2323
Created August 23, 2018 10:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tesladev2323/c4cf1e9b1fda32fa1d77b0c4ae74902f to your computer and use it in GitHub Desktop.
Save Tesladev2323/c4cf1e9b1fda32fa1d77b0c4ae74902f to your computer and use it in GitHub Desktop.
[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