Skip to content

An Unreal Engine C++ project with Raytracing enabled, built on top of the Third Person Template, with some edits to behave as a True First Person implementation as if from Epic Games.

License

Notifications You must be signed in to change notification settings

JDSherbert/Unreal-Engine-True-First-Person-Template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

image

Unreal Engine True First Person Template

Stars Badge Forks Badge Watchers Badge Issues Badge


Unreal Engine Template Unreal Engine 5.4 License




Overview

True First Person refers to a perspective in video games where the player's viewpoint is exactly from the character's face, providing an immersive experience as if the player is seeing the game world directly through the character's eyes. This is in contrast to the traditional first-person view, which often only renders the character's hands and weapon, if any, without showing the rest of the body. This perspective is commonly used in AAA first person shooter titles - games such as Far Cry, Call Of Duty, Halo and Mirror's Edge.

This template is a C++ project with Raytracing enabled. It's built on top of the Third Person Template, with some edits, as if it was a real True First Person implementation from Epic Games.

This code creates the True First Person camera and attaches it to the head bone of the character mesh. Note that we need to use a custom FRotator() because otherwise the camera will not be aligned correctly. We also set the location slightly forward on the Y axis so we cannot look down through our own mesh.

// SherbertTFPTemplateCharacter.cpp //

// Create a True First Person camera
TrueFirstPersonCamera = CreateDefaultSubobject<UCameraComponent>(TEXT("TrueFirstPersonCamera"));
TrueFirstPersonCamera->SetupAttachment(GetMesh(), "Head");
TrueFirstPersonCamera->SetRelativeLocation(FVector(0.0f, 10.0f, 0.0f));
TrueFirstPersonCamera->SetRelativeRotation(FRotator(0.0f, 90.0f, -90.0f));
TrueFirstPersonCamera->bUsePawnControlRotation = true; // Camera rotates relative to pawn

This is also important to disable Controller Rotation because it allows the character to rotate with the camera. Otherwise, the camera rotates independently of the character which can be disorienting.

// SherbertTFPTemplateCharacter.cpp //

// Don't rotate when the controller rotates. Let that just affect the camera.
bUseControllerRotationPitch = false;
bUseControllerRotationYaw = true;
bUseControllerRotationRoll = false;

About

An Unreal Engine C++ project with Raytracing enabled, built on top of the Third Person Template, with some edits to behave as a True First Person implementation as if from Epic Games.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published