What do I have :
A top-down game where a camera follows the player. It is on X-Z plane. For now the camera follows the player across X-Z plane by the player’s global position and mainatains a certain height from the player. The center of the level is a cylinderical object thats spans for the entire height of the level.
When do I think would happen?
The player is free to roam around the level (X-Z) but at certain point, the player might tend to get near the cylindrical object. Hence I would like to change the behaviour of the camera at that particular instance.
What do I want :
When the player reaches near a cylindrical object (say Radius ‘r’ from the center), I would like to camera to lock its position i.e. maintain the distance (radius) from the cylinder. But as the player has the freedom to move around the cylinderical object, there are exceptions when it gets out of the camera’s view. Hence at this instance, I would like the player to rotate around the cylinderical object when the player does so.
Image Representation :
First Image :
The camera follows the player above its global position.
- Second Image : The player enters a radius ‘r’ from the center of the cylinder. Hence the player stops following and locks it’s distance from the player.
- Third Image : An exception that is caused is the movement of the player within the radius ‘r’ from the center. Hence in order to have the player inside the view of the camera, the camera follows the player by maintaining a distance and thus suffer rotation.
- Fourth Image :Player moves and so does the camera. The rotation is similar to a merry-go-round.
Thank you once again,