How can I lerp (linear interpolate) the camera of top view game which has follow on player so it doesn't tremble as it gets close to the target. This is the code I use for camera translation:
//Creating a vector 3 which represents the target location (my player)
Vector3 target = new Vector3(
(float)player.getPosition().x*map.getTileWidth()+(float)map.getTileWidth()/2,
(float)player.getPosition().y*map.getTileHeight()+(float)map.getTileHeight()/2,
0);
//Creating vector 3 which gets camera position
Vector3 cameraPosition = camera.position;
//Interpolating (lerping) vector
cameraPosition.lerp(target, 0.1f);
//Updating camera and setting it for batch
camera.position.set(cameraPosition);
camera.update();
batch.setProjectionMatrix(camera.combined);
I think I did this right but the alpha value might be too small, yet again if i make it bigger then camera moves too fast and other issues appear. Can i make the trembling stop with this alpha value (in my example alpha is 0.1f)?