I am working on a script where the camera follows the player (only on 'y' axis). If the player moves in X or Z axis I would like the camera to follow only when the player moves beyonds a circle with a radius 'r' and the origin as camera's X & Z co-ordinates.
To brief it in another view, I would like to have camera's co-ordinates (X & Z) as origin and with a radius r, I want to create a imaginary circle. Lets say a gameobject is a target for the camera and the camera is following the target across Y axis. I would like the camera to follow the player, one and only if it moves beyond the CIRCLE.
I did try out but I got stuck at a certain point. The code is as follows,
Please do help me, if you could. If you think any other solution, kindly let me know.
Thank you and Please,
Put this script on your camera (untested):