- Home /
Replicating the Focus feature
My game requires the user to be able to focus on objects just like wat happens when we press 'F' in the editor.The one place im stuck is how would i calculate the distance of the camera from the object , as the objects might differ in size?
Any hellp would be appreciated!
Comment
Answer by Teare · Apr 23, 2011 at 08:21 PM
You could use the object's Collider.bounds properties:
http://unity3d.com/support/documentation/ScriptReference/Bounds.html
This would give you the extents of the object and you could calculate the necessary distance based on what object's largest side.