- Home /
Question by
alek123 · Dec 28, 2012 at 06:48 PM ·
cameragameobjectdistanceview
Distance gameobject to camera edge
Hi guys how can I check a distance beetwen gameobject and camera edge see image below or check a gameobject is in camera view.
I want make a dynamic camera, when distance beetwen GameObject and edge is 20 then camera move back or if gameobject is out of camera view then camera move back unitl gameobject is in camera view
cameraview.png
(34.9 kB)
Comment
Answer by EBR · Aug 27, 2013 at 10:35 PM
Have your tried using WorldToScreenPoint? (http://docs.unity3d.com/Documentation/ScriptReference/Camera.WorldToScreenPoint.html) it should do the trick