I have the following code for the camera of my game:
// Updating the player
m_player.update(frame, m_quadTree);
// Getting the center position of the player
sf::Vector2f playerCenter = m_player.getCenter();
// Setting the center of the map(show only visible tiles)
m_map.setPlayerCenter(playerCenter);
// Setting the view to the center of the player
m_view.setCenter(std::floor(playerCenter.x), std::floor(playerCenter.y));
The problem is that when I jump only on vertical axis( only up arrow) the tiles are like trembling, and when i jump on diagonals( up arrow + left/right arrow) also the player start to tremble. Some tips please?
Here is a video with the problem:
EDIT: Setting the view center to the exact position resolv the problem, but also activate another problem discussed here.
EDIT2: Problem resolved: the player position is now also set with std::floor()