-
-
Save Tesladev2323/c4cf1e9b1fda32fa1d77b0c4ae74902f to your computer and use it in GitHub Desktop.
[End Result] Classic Camera C++ - PlayerCamera.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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