1
Graphics / Move the view if the entity's out view.
« on: June 11, 2018, 09:48:45 am »
How can I make the view follow the player entity when it's nearly out of the drone's (the view) view.
I have here my code for the drone's movement.
What I want to achieve is to make the drone follow the player, but not really following the player's new position as it moves real-time. Instead, the drone will SMOOTHLY MOVE if the player is NEARLY OUT OF VIEW (not hitting the view's boundary).
I have here my code for the drone's movement.
void World::update(const sf::Time& deltaTime)
{
mSceneGraph.update(deltaTime);
mDrone.setCenter(mPlayer->getPosition());
}
{
mSceneGraph.update(deltaTime);
mDrone.setCenter(mPlayer->getPosition());
}
What I want to achieve is to make the drone follow the player, but not really following the player's new position as it moves real-time. Instead, the drone will SMOOTHLY MOVE if the player is NEARLY OUT OF VIEW (not hitting the view's boundary).