S
seanm
Guest
Hey, it's been a while since I've been on here. I'm back with another issue that most people will likely find to be too small to worry about, but I'm worryin about it.
My Problem
I'm using lerp to smoothly move my camera to my players position. Super basic camera that everyone does.
However, what I've noticed is that this code actually makes the camera really shaky.
The camera will smoothly follow the player, but every ~4 frames the camera will stay in the same place.
Meaning there are constant stutters in the cameras movement. It decides it doesn't need to move on one frame, and then has to make a small jump to catch up on the next frame.
What do?
I think the stutter occurs when the camera gets close to its destination, ie the player.
One way I might be able to fix this:
Anyway, just wondering if anyone has thought about this, or has any ideas.
Cheers,
Sean
My Problem
I'm using lerp to smoothly move my camera to my players position. Super basic camera that everyone does.
Code:
x += (objPlayer.x-view_wview[0]/2 - x) * lerpSpd
//or
x = lerp (x, objPlayer.x - view_wview[0]/2, lerpSpd)
The camera will smoothly follow the player, but every ~4 frames the camera will stay in the same place.
Meaning there are constant stutters in the cameras movement. It decides it doesn't need to move on one frame, and then has to make a small jump to catch up on the next frame.
What do?
I think the stutter occurs when the camera gets close to its destination, ie the player.
One way I might be able to fix this:
- Have the camera try to lerp the player back to the center of the screen,
- but only activate the lerp when the player is a certain distance away from the center of the screen
Anyway, just wondering if anyone has thought about this, or has any ideas.
Cheers,
Sean