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.
Unity Version used for this tutorial is 2020.3.3f1.
Stable Build - main is the stable version of the tutorial and is similar to the one shown in the Video
The main scripts for solving this issue are PlayerRotate and PlayerRotateSmooth. Both of these scripts are needed to solve the issue.
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.
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.
- (Video) Unite 2016 - Tools, Tricks and Technologies for Reaching Stutter Free 60 FPS in INSIDE
- (Video) Brackeys - FIRST PERSON MOVEMENT in Unity - FPS Controller
- (Video) SpeedTutor - FREE FPS Character Controller for UNITY 2020!
- (Video) Magic Monk - Unity 2018.2 First Person Adventure Game Tutorial 4 - Mouse movement, camera & player rotation
- (Video) Ned Makes Games - Setting Up a Smooth Mouse Look Camera Controller Script in Unity ✔️ 2020.3 | Game Dev Tutorial
- (Blog) Nothke's Dev blog - How to Cope with Standard Unity FPS Controller
- (Blog) IronEqual - Unity: CHARACTER CONTROLLER vs RIGIDBODY
- (Unity Blog) Tautvydas Žilys - Fixing Time.deltaTime in Unity 2020.2 for smoother gameplay: What did it take?
- Syed Shaiyan Kamran Waliullah
This project is licensed under the MIT License - see the LICENSE.md file for details.