Player Jittering with Camera Follow

Started by
9 comments, last by Magdev 10 years, 10 months ago

You have misunderstood my suggestion. Let suppose the player is moving 1 pixel in some direction. Since (playerPos - camPos)*strength is not related to the player movement, it can be any value. In particular, it may rounds to 2 pixels in the same direction. The result is the player moving one pixel in the wrong direction. In the next frame the player will move of 2 pixels and the camera of some other amount and you now see a jitter. The jitter is caused by the difference between the camera position and the player position not being a monotonic function. My suggestion is thus to make it monotonic by clamping the camera position so that it does not move faster than the player. When the player is still you clearly have to catch the player if you do not want the player to exit from the screen.

Ooh. I understand. Yeah, I'll definitely try that.

This topic is closed to new replies.

Advertisement