deadlykam / TutorialFPSRotation

A tutorial on how to get smooth first person rotation in Unity3D

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TutorialFPSRotation

Introduction:

A tutorial on how to get smooth first person rotation in Unity3D. While making a first person view game you will notice mainly in the build game that when you rotate the camera the game stutters/jitters a lot which gets noticable when circuling around an object. In this tutorial I am showing one of a way to fix that. Watch my Video to get a detailed understanding of the issue, the cause of the issue and the solution to the issue. If my solution doesn't work then I have linked to other sources in Research Links that fixes this issue using other means.

Table of Contents:


Prerequisites

Unity Game Engine

Unity Version used for this tutorial is 2020.3.3f1.


Stable Build

Stable Build - main is the stable version of the tutorial and is similar to the one shown in the Video


Main Scripts

The main scripts for solving this issue are PlayerRotate and PlayerRotateSmooth. Both of these scripts are needed to solve the issue.

PlayerRotate:

This script rotates the player and camera normally. Using this script will show the rotation is smooth in the editor but NOT in the build game. From my research the reason is because of VSync which lowers the fps of the game to the monitor refresh rate which in my case was 60fps because my monitor refresh rate is 60Hz.

PlayerRotateSmooth:

This script fixes the stuttering issue caused by VSync in the build game. The camera rotates smoothly. Using this script in the editor will make the rotation very very slow. It is adviced to use the PlayerRotate script when testing in the editor.


Research Links


Authors


License

This project is licensed under the MIT License - see the LICENSE.md file for details.


About

A tutorial on how to get smooth first person rotation in Unity3D

License:MIT License


Languages

Language:C# 100.0%