Camera Stutter no matter what I do

I have a camera and no matter what I do to make this thing stop jittering, it keeps jittering. In the video, I’m showcasing a camera script made in the Unity Asset Store that works in the example scene, but when attached to my ship, the ship still spazzes out.

The other method is just straight child pairing it to the ship. Same jitter. And yet nothing but the ship jitters. The asteroids and planet are perfectly fine.

I know about lateupdate and the script uses lateupdate to do its transforms. I cannot figure this out and it’s driving me up a wall. If anyone could help, I’d be much appreciative.

Thanks!

Can you show the camera’s world space position, as well as the camera’s near and far clipping plane settings?

My suspicion is that it is either you are far from origin, or the near clipping plane is set too low for how high the far clipping plane is set.

Imgur


I changed the clipping planes to as low as 1 and 1000. 1 clipped out some of the ship, but what remained still was shaking heavily.

Edit: Woops, that’s local space. World space is:
x: -16868.7
y: 6387.5
z: -6778.047

Edit 2: Oh lord… I just moved the whole thing to 0,0,0 and it stopped jittering. I guess I need to scale the entire thing way down. Thank you for pointing my brain in the right direction!

1 Like

Yup. Moving far away from 0 (origin) will start to produce issues. A technique some games use (like Outer Wilds) is to always keep the player at 0,0,0 and instead move the world around the player! Same end result, but no crazy numbers on the camera.

1 Like

Scaling down everything is unlikely to fix the issue. The smaller the thing is, the lower the distance from origin you see the effect.

You can use a technique called “floating origin”. It is very simple. All you do is periodically reset the player back to origin, and move all world objects by the same amount you moved the player. So you just record the player’s current position, subtract that position from the player’s position (or just set to Vector3.zero), and then subtract the player’s previous position from the positions of all world objects. You do this either on a set schedule or whenever the player has traveled a certain distance from origin.

Holy crap, thank you. These are great ideas I had not even remotely thought of. So simple, too!

Also totally watching that documentary. Thank you for the link.

Y’all really went above and beyond here. Much appreciated.