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; } } } }
@Hirte20002 ай бұрын
if i put that script on the player, he will rotate with the camera, but the jittering is back
@MichaelH-zb8gg2 ай бұрын
@ElekriGames strange it worked on mine but I'll check it incase I changed any other setting in cinemachine. Will look at it tomorrow.....
@MichaelH-zb8gg2 ай бұрын
@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....
@Hirte20002 ай бұрын
@@MichaelH-zb8gg if you could sent the code tomorrow it would be great im stuck like a week with this problem
@MichaelH-zb8gg2 ай бұрын
@@Hirte2000 No prob will do...
@controlledsingularity80844 ай бұрын
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.
@vinhnguyen-o5z14 күн бұрын
"You are done." Why are you intimidating me
@stillzen-devАй бұрын
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
@SirMust10813 күн бұрын
hi i use your solution and my rotation problem was solved but now i cant control my character because when i want to go forward when i looking right, my character wants to go left :/ the inputs arent change here is my code public class PlayerController : MonoBehaviour { [SerializeField] float moveSpeed; [SerializeField] float sensitivity = 0.1f; [SerializeField] int jumpPower; [SerializeField] Transform camTransform; Transform groundCheck; Rigidbody rb; Vector3 moveDirection; Vector2 currentRotation; private void Awake() { rb = GetComponent(); groundCheck = transform.GetChild(1); camTransform = transform.GetChild(0); } private void Start() { Cursor.lockState = CursorLockMode.Locked; } private void FixedUpdate() { rb.AddForce(new Vector2(moveDirection.x * moveSpeed, moveDirection.y * moveSpeed)); } public void OnMove(InputAction.CallbackContext context) { Vector2 inputDirection = context.ReadValue(); moveDirection = new Vector2(inputDirection.x, inputDirection.y); } public void OnJump(InputAction.CallbackContext context) { if (IsGrounded() && context.performed) { rb.AddForce(Vector3.up * jumpPower, ForceMode.Impulse); } } public void OnRotate(InputAction.CallbackContext context) { Vector2 mouseDelta = context.ReadValue(); currentRotation.x += mouseDelta.x * sensitivity; currentRotation.y -= mouseDelta.y * sensitivity; currentRotation.y = Mathf.Clamp(currentRotation.y, -90f, 90f); } private bool IsGrounded() { return Physics.CheckSphere(groundCheck.position, 0.2f); } }
@JeraldTheBEARАй бұрын
Oh wow. Kinda forgot about that fixedupdate kinda thing. I’m gonna go cry now
@nikz0003 ай бұрын
I just interpolated the rotation values between each fixedupdate in update
@Arctic.Wolves2 ай бұрын
what about godot?
@EuclidStreams3 ай бұрын
just use late update for camera rotation lol, wtf
@novs7353 күн бұрын
Cool video but not recommend to use motion blur in it. I want to watch those things clearly without pausing
@qroundhawk714915 күн бұрын
Still have jittering, followed all steps.
@Ementss2 ай бұрын
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.
@forcepower7116Ай бұрын
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
@ze1st_4 ай бұрын
but how did cinemachine fix this?
@semikoder4 ай бұрын
Cinemachine incorporates the solutions I've mentioned at 8:19
@ze1st_4 ай бұрын
@@semikoder thx. But when i enable interpolation my players movement becomes broken wtf.
@vinhnguyen-o5z14 күн бұрын
rotating camera and other stuff is always ass for me. The inspector display one number, eulerAngle display another, which makes clamping kind of a pain
@MayKayyАй бұрын
Thank you so much you are best!!
@problem1O15 ай бұрын
Cinematic cut-scene tutorial 🙌
@andrescarvajal29812 ай бұрын
i dont have event OnMouseMove :( why?
@salithaanildesilva11962 ай бұрын
How do i get the first person template
@Th3_V3ct0rAT23 ай бұрын
Will it work on mobile devices?
@StephHami4 ай бұрын
how do you add the Cinemachine namespace in my C# scripts
@ZeonplayzYt5 ай бұрын
pls make tutorial on how to make cod mw type movement and camera animations
@sebastiangeraldohirales49354 ай бұрын
I can only find the cinemachine 2.9 version
@GamerBoi90002 ай бұрын
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)
@Rauza315 ай бұрын
usually when utilising a camera with a rigidbody it is good to have it separated because that also prevents the camera jittering
@blinkachu52752 ай бұрын
It also happens on a CharacterController which isn't a Rigidbody, so that doesn't matter
@Rauza312 ай бұрын
@@blinkachu5275 I’ve never experienced this while using a cc before?
@Montigorable4 ай бұрын
Thanks for the solution!
@StephHami4 ай бұрын
where do i get cm3
@StephHami4 ай бұрын
you have to have the latest version of unity
@sebastiangeraldohirales49354 ай бұрын
x2
@StephHami4 ай бұрын
@@sebastiangeraldohirales4935 ?
@srydustar57543 ай бұрын
It's crazy how you have to do all those steps in Unity and in Unreal you don't 😂