Thanks to this answer, I'm using bpy.ops.view3d.camera_to_view_selected() to automatically place a camera so that it frames the selected object for rendering. But presumably there are lots of (x,y,z) locations within the scene where the camera could be placed and still frame the object.

Does anyone know how Blender decides which of these locations to move the camera to? For example, does it take the starting position of the camera into consideration?


  • 1
    $\begingroup$ From playing with this operator, it appears that: It does not change the angle of the camera. For a given angle (view vector) there is only 1 solution no matter what the starting position of the camera is. The camera aligns with the object so that it is "in front" of it in the camera's local space. It will require either trial and error or the time to delve into the source code to give a mathematical / algorithmic answer. $\endgroup$ – TLousky Dec 13 '16 at 16:31
  • $\begingroup$ Yes, looks like you're right. Rotation is unaffected by bpy.ops.view3d.camera_to_view_selected(), so there's only one possible location for the camera. Thanks! $\endgroup$ – user2950747 Dec 13 '16 at 18:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.