Converted from the JavaScript source code in http://imdaunity.blogspot.kr/2011/02/camera-follow-script.html