|
Hello Devs, 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, Karsnen.
(comments are locked)
|
|
Put this script on your camera (untested): Thanks Dave. Testing it right away...
Jul 19 '12 at 02:15 PM
Karsnen
(comments are locked)
|

How about I use a cylindrical collider and then instruct the camera to follow the gameobject on CollisionExit and Not to follow the player on CollisionEnter.
Again I have optimization concerns, as it would be run throughout the entire game and the target platform is ios?
I'm having trouble understanding what you're trying to accomplish, could you draw a diagram or something visual?
Why are you recalculating this per frame? Why not create a disc mesh and just scale/translate it around?