Here's a short explanation of how to actually do this whitout needing cinemachine or other crap: Step1: create a empty game object. This is the game object you will be moving around in update and represents the target position of your camera. Step2: create a script that interpolates the position and rotation of your camera towards this empty game object, about 0.6-0.8 of the way per frame will do. Step3. Done. You are done.
Nice Tutorial. I've updated to 3.0.1 and it works well. The only problem with Cinemachine is setting up player rotation on camera movement. So below is a script to handle the player rotation on camera movement. Put the script below on the player. using UnityEngine; public class PlayerRotate : MonoBehaviour { private Camera mainCamera; private void Start() { // Find the main camera in the scene mainCamera = Camera.main; } private void Update() { // Rotate the player towards the camera every frame RotatePlayerTowardsCamera(); } private void RotatePlayerTowardsCamera() { if (mainCamera != null) { Vector3 cameraForward = mainCamera.transform.forward; cameraForward.y = 0f; // Ignore the y-axis rotation if (cameraForward != Vector3.zero) { Quaternion newRotation = Quaternion.LookRotation(cameraForward); transform.rotation = newRotation; } } } }
@ElekriGames Ok, I see what is wrong. I had two projects runing I've posted the code for use with the character controller. I'll post the code for use with rigidbody tomorrow. Sorry about that....
it depends on the unity version you're using. Cinemachine 3.x is available after Unity 2023.1 (you have to use a preview version) and 2023.2 (full release)
So the best way to make a first person camera is to not make one and use a plugin, great job, why make a 10 minute tutorial on failed solutions if you're just gonna use a plugin.
I kinda agree with you on the use of plugins, but cinemachine, the new input system and textmeshpro are all plugins that should be in Unity from the start if we are honest these 3 plugins are so powerful and Unity itself uses them
Here's a short explanation of how to actually do this whitout needing cinemachine or other crap:
Step1: create a empty game object. This is the game object you will be moving around in update and represents the target position of your camera.
Step2: create a script that interpolates the position and rotation of your camera towards this empty game object, about 0.6-0.8 of the way per frame will do.
Step3. Done. You are done.
Nice Tutorial. I've updated to 3.0.1 and it works well. The only problem with Cinemachine is setting up player rotation on camera movement. So below is a script to handle the player rotation on camera movement. Put the script below on the player.
using UnityEngine;
public class PlayerRotate : MonoBehaviour
{
private Camera mainCamera;
private void Start()
{
// Find the main camera in the scene
mainCamera = Camera.main;
}
private void Update()
{
// Rotate the player towards the camera every frame
RotatePlayerTowardsCamera();
}
private void RotatePlayerTowardsCamera()
{
if (mainCamera != null)
{
Vector3 cameraForward = mainCamera.transform.forward;
cameraForward.y = 0f; // Ignore the y-axis rotation
if (cameraForward != Vector3.zero)
{
Quaternion newRotation = Quaternion.LookRotation(cameraForward);
transform.rotation = newRotation;
}
}
}
}
if i put that script on the player, he will rotate with the camera, but the jittering is back
@ElekriGames strange it worked on mine but I'll check it incase I changed any other setting in cinemachine. Will look at it tomorrow.....
@ElekriGames Ok, I see what is wrong. I had two projects runing I've posted the code for use with the character controller. I'll post the code for use with rigidbody tomorrow. Sorry about that....
@@MichaelH-zb8gg if you could sent the code tomorrow it would be great im stuck like a week with this problem
@@ElekriGames No prob will do...
Cinematic cut-scene tutorial 🙌
Thank you so much you are best!!
Thanks for the solution!
wish this existed 2 fookin years ago - too late to change my system now (+ i'm using version 2020) but this will save many devs going forward
but how did cinemachine fix this?
Cinemachine incorporates the solutions I've mentioned at 8:19
@@semikoder thx. But when i enable interpolation my players movement becomes broken wtf.
usually when utilising a camera with a rigidbody it is good to have it separated because that also prevents the camera jittering
It also happens on a CharacterController which isn't a Rigidbody, so that doesn't matter
@@blinkachu5275 I’ve never experienced this while using a cc before?
Oh wow. Kinda forgot about that fixedupdate kinda thing. I’m gonna go cry now
I just interpolated the rotation values between each fixedupdate in update
how do you add the Cinemachine namespace in my C# scripts
i dont have event OnMouseMove :( why?
How do i get the first person template
Will it work on mobile devices?
what about godot?
pls make tutorial on how to make cod mw type movement and camera animations
I can only find the cinemachine 2.9 version
it depends on the unity version you're using. Cinemachine 3.x is available after Unity 2023.1 (you have to use a preview version) and 2023.2 (full release)
So the best way to make a first person camera is to not make one and use a plugin, great job, why make a 10 minute tutorial on failed solutions if you're just gonna use a plugin.
I kinda agree with you on the use of plugins, but cinemachine, the new input system and textmeshpro are all plugins that should be in Unity from the start if we are honest these 3 plugins are so powerful and Unity itself uses them
where do i get cm3
you have to have the latest version of unity
x2
@@sebastiangeraldohirales4935 ?
just use late update for camera rotation lol, wtf
It's crazy how you have to do all those steps in Unity and in Unreal you don't 😂
Totally true