I’m working on a third person shooter project, I’m trying to make 2 different types of aim, normal aim & scoped, However the player (Character controller / capsule collider) keeps jittering.
I’ve two Cameras (Main Camera & Scope Camera) and they have Cinemachine brain on each, all the code related to the cameras are in Late Update.
The Cinemachine paradigm is that you should only have a single Unity Camera with a CinemachineBrain. Then, you have multiple Cinemachine Virtual Cameras (or FreeLooks), that are all separate GameObjects, not parented to each other or the main camera.
Think of the Virtual Camera as an animator for the main camera. When one is active, the main camera positions itself to match the virtual camera (that’s the brain’s job). To switch cameras, you deactivate the current virtual camera and activate a new one. The main camera will then reposition itself accordingly.
I suggest that you reorganize your scene to be along those lines. Have a look at some of the sample scenes that ship with CM. There is one that implements normal vs aim cameras.
I’ve main camera and 3 Virtual cameras (normal - aim - scope), however I managed to configure them but I’m facing two different issues here.
The First one: is the cameras is jittering while I’m moving the character however, I’ve done all the code related to the Cinemachine in the (Late Update)
The Second One: is when I’m aiming the virtual camera rotates around the empty game object that the camera follows, so the player appears and block the view of the camera.
Main Camera and the other 3 virtual camera are not parented with any game object.
I’m using Character Controller & Capsule Collider
I’m trying to make the player aim with weapon as its first-person shooter while he can aim in third person view.
I’m not sure what you mean by “code related to the Cinemachine”. Usually there is none, because Cinemachine tracks the target by itself. Jittering while the target is moving is usually symptomatic of irregular movement of the target. Very often this is due to improper manipulation of the Rigidbody. Can you elaborate about how exactly you’re making the target move?
Can you describe the behaviour that you want the aiming camera to have? It seems pretty weird to me to have the aiming camera rotate around something that isn’t the player.
I don’t understand that sentence. Can you describe more fully? If there is a video of something similar that you can point me to, that could help.
I’m using the starter asset package for third person shooter, I’ve created another virtual camera for the aim purpose, the Player has a character controller & Capsule collider attached to it.
Whenever the player is in aim mode , I’ve enabled the another virtual camera to be Live, the player keeps jittering.
When the player is in (Scope mode), I want the virtual camera to look at the scope and the game view becomes FPS.
In that case, when the FPS camera is active, you should make your player invisible. I assume that the camera is placed on the player’s head, where the eyes are. Is that correct?
Can you show the inspectors for Aim vcam and for Scope vcam?
I’ve created a secondary camera without having a Cinemachine brain, and make it child of the right hand of the player and whenever I need to make FPS I switch to it without disabling the main camera. Thanks for helping me out as this statement of your was the key (It seems pretty weird to me to have the aiming camera rotate around something that isn’t the player.)
I’ve one more issue here that the player keep jittering when the camera follows him, as far as I’ve searched that the camera didn’t jitter but the game object especially when it have a rigidbody on it and to allow interpolate will fix this issue
and I’ve only I’ve character controller & capsule collider on the character
That does not explain how you are moving the character. If you move it unevenly, it will appear to jitter on-screen. You must move it evenly, in Update(), correctly taking Time.deltaTime into account.