local x1,y1,z1,x2,y2,z2 = getElementBoundingBox ( element ) local dx = x2-x1 local dy = y2-y1 local width = math.sqrt( (dx*dx) + (dy*dy) ) local height = math.abs(z2-z1) outputChatBox ( "Height: "..tostring(height).." Width: "..tostring(width) ) --cameraLeverage = 0 outputChatBox 'tes1' local fRadius = getElementRadius ( element ) --outputChatBox ( "maxDist: "..tostring(maxDist) ) --local realDistance = ( maxDist / elementDiameter ) * camDistance outputChatBox 'tes2' local camAngleX = camTargetX - camPosX local camAngleY = camTargetY - camPosY local camAngleZ = camTargetZ - camPosZ --normalise the angles local l = math.sqrt( camAngleX*camAngleX + camAngleY*camAngleY + camAngleZ*camAngleZ ) local camAngleX = camTargetX / l local camAngleY = camTargetY / l local camAngleZ = camTargetZ / l outputChatBox 'tes3' local elementPosX = camPosX + ( camAngleX * fRadius ) local elementPosY = camPosY + ( camAngleY * fRadius ) local elementPosZ = camPosZ + ( camAngleZ * fRadius ) outputChatBox ( "x: "..tostring(elementPosX).." y: "..tostring(elementPosY).." z: "..tostring(elementPosZ) ) outputChatBox 'tes3' setCameraPosition ( camPosX, camPosY, camPosZ ) setElementPosition ( element, elementPosX, elementPosY, elementPosZ ) setTimer ( "setCameraLookAt", 100, 1, camTargetX, camTargetY, camTargetZ ) outputChatBox 'tes4'