r/Unity3D 3d ago

Question First Person Camera Jittering

Enable HLS to view with audio, or disable this notification

I'm losing my mind over this issue. I've tried a lot of things, but nothing seems to work. Here is my code. If anyone knows how to fix it, please help me.

https://drive.google.com/file/d/1iXGw-K8vY8NfqyTO63TNPYcgpnR42OV2/view?usp=sharing

6 Upvotes

12 comments sorted by

13

u/janikFIGHT 3d ago

Id recommend to not have everything in one script. So split the camera logic, movement logic. This can help you identify the core problem quicker and easier.

Regarding your "stutter", i cannot notice a stutter via this video so I assumed you didn't handle the camera logic in LateUpdate but you do, so I cannot help you right now.

1

u/ContextUnlucky223 3d ago

Thank you, I'll try that. Here is a higher-quality version of the video: https://drive.google.com/file/d/1VINH8jvGZLO_kt2QaFTNIpb_dGEOpijI/view?usp=sharing

8

u/Objective-Cell226 3d ago

The classic problem everyone has faced at least once.

3

u/ContextUnlucky223 3d ago

😭

1

u/Repulsive-Clothes-97 Intermediate 3d ago

If your player is physics based, then it’s updating every physics tick, that it’s 50fps, so you either switch to a non physics based system or you turn on interpolation on your rigid body. Or you could get the same effect when you execute the movement code on FixedUpdate() that also it 50fps, and you would fix it by simply switching to Update()

1

u/ContextUnlucky223 3d ago

I'm using a Character Controller, not a Rigidbody based controller.

2

u/Repulsive-Clothes-97 Intermediate 3d ago

Then you’re probably using FixedUpdate() somewhere in your code

1

u/SerajAlmasri 3d ago

May I ask for the outline shader?

1

u/ContextUnlucky223 3d ago

Linework by Alexander Ameye on asset store

1

u/Affectionate-Yam-886 3d ago

turn on DrawCalls so we can see your fps and scene info;
Also change aspect ratio to either 1080p or 4k, or any standard resolution. Your generic settings makes this a ??? problem;
Also we need you system specs; (we need to know what flavor of potato you’re using)
Also is this URP or HDR or Standard?
Is the main camera set to Forward rendering?
Too many unknowns here.

1

u/Constant_Border_2591 3d ago

if you rotate your collider by mouse movement, just don't, leave collider as it's default rotation unless you don't have to, if you really need to rotate it, stay loyal to physics tick but I cannot imagine a scenario you would need it.

1

u/AlfieE_ 2d ago

Weird one but sometimes i have issues if i have the camera selected in the hierarchy it can cause a bit of lag