Hey,
I’m using Vector3.SmoothDamp to make my camera follow my player smoothly, it works perfectly, but i’m trying to round my camera’s position so that it snaps to the pixels.
My code works fine in editor but when running the build with a much higher FPS, the cam is super jerky and fast.
There must be something i’m doing wrong, is anyone able to explain what is going on?
This is running in Update, why is it framerate dependent?
Vector3 smoothedCam = Vector3.SmoothDamp(cam.transform.position, player.transform.position, ref velocity, camSpeed);
cam.transform.position = new Vector3(Mathf.Round(smoothedCam.x * pixelsPerUnits) / pixelsPerUnits, Mathf.Round(smoothedCam.y * pixelsPerUnits) / pixelsPerUnits, cam.transform.position.z);