I’m doing a 3D game and until now I was using a simple camera in FPS. I changed my FPS system into a TPS system with cinemachine. Everything work perfectly except one thing.
I have a system of target on screen to indicate quest mark and other… but with some jittering since I have install cinemachine …
The problem :
Like you can see, when i’m moving the joystick left for moving the player , the UI begin to jitter …, but not with the right joytsick wich control the camera
I’m using the new input system with cinemachine.
If someone can explain me how to resolve that I’ll really appreciate
I don’t understand the link between my UI , and the way like I move my character …
For moving the character, i’m using a simple rigidbody and RB.AddForce in FixedUpdate()
I get the joystick movement with:
Normally jittery UI happens because the UI is placed before CM has updated the camera position, so it’s using stale data from the previous frame. If you are computing the UI location based on the screen position of some world object, then be sure to do this after CM has positioned the camera.
There are 2 ways to do this:
With script execution order. CM moves the camera in CinemachineBrain.LateUpdate, and CinemachineBrain has a custom update order which is set to be very late. You must give your UI placement script an even later update order, and put your code in LateUpdate.
Add a handler to CinemachineCore.CameraUpdatedEvent which gets called after the camera is positioned. Compute your UI position there.
I’m come back here because I have change the execution order , but I thinks I have this problem with other things with the same problem but I didn’t success…
I’m using Rig Layer and “Two Bones IK Constraint” to raise my player arm in front of him what ever the animation.
When I’m rotate the player, the arm of my player jittering …
I tried a simple solution that’s explain in a video : In CinemachineBrain component, change Blend Update Method : Late update to : Fixed Update.
But now, my arm don’t jitter anymore, but all my scene yes ! …
Can you explain me how to resolve that? ^^’
ps : how can I " Add a handler to CinemachineCore.CameraUpdatedEvent" ?
FixedUpdate vs LateUpdate is a complicated issue. In general:
If your characters are moving in Update or LateUpdate, then the Brain should be set to LateUpdate.
If your character are moving in FixedUpdate (for example because they are non-kinematic RigidBodies being moved by the physics simulation and do not have Interpolation enabled) then the brain should be set to Fixed Update
If your characters are doing some combination of both, then something will jitter
The solution is to be consistent in how you animate the things that the cameras are tracking. Either all in Update, or all in FixedUpdate, but not both.
for the ps: CinemachineCore.CameraUpdatedEvent.AddListener(MyHandler);
I also have an issue with jittery UI and Cinemachine. But my Canvas is placed automatically by Unity in front of the camera every frame, since I’m using “Screen Space - Camera”. How do I go about changing the script execution order in this case?
@iddqd Your canvas in this case should not jitter. Something else must be going wrong. Can you give more details about your setup? Can you show a video? What version of CM are you using?
I find a other simple solution, In my game , I have a object that follow the player in the update . I set this object into the 'follow" parameter of the Cinemachine Camera , and since I have no jitter whatever i’m doing with my character ^^
For what it’s worth, I was just having this issue as well. I moved my UI - Canvas - Plane Distance back a bit from 1 to about 30 and it seems to have stopped the jitter in the UI.
Yeah, I had my world space canvas very close so it doesn’t get clipped. Moving it further back removed the jittering (or at least it’s no longer visible), but then GameObject will come in front of it, making it useless as a UI. So a separate camera or canvas overlay would be the solution.
But I guess it technically still shouldn’t jitter even when very close.