Getting the 0,0,0 point in the middle of the Camera

I apologize if this isnt in the right section, but I figured there would be some scripting involved to do this process.

What I am looking to do is get the 0,0,0 point to the middle of the camera. I would like to be able to maintain the angle at which the scene is at and not rotate the camera, but instead just have it so the 0,0,0 point becomes the middle of the cameras view.



Lets say this is the initial view after aligning the camera.


I would like to be able to snap the camera looking at the 0,0,0 point and have that be in the center.

Thanks you

If I’m understanding you correctly you want the camera to automatically point to the center of the scene, you can use the Damped Track constraint on the camera to make it point to an object that’s in the center of the scene.

Try a TrackTo constraint on the camera with the target being an empty or object at the origin, set the ‘To’ to -Z, and the ‘Up’ to Y. It provides a similar effect to Damped Track, but with more predictable results. It pairs really well with a path constraint on the camera too. But with either option, it’s best to move your camera when you’re not in camera view as the constraint can make things a bit glitchy.

Have it figured out. Its a script regarding an line-plane intersecting problem. The TrackTo constraint changes rotation which I was not looking for. Some trig solved the issue and a script was written to solved this issue. Thank you for the input though.

import bpy
from mathutils import Vector

get camera object

camera = bpy.context.blend_data.objects[“Camera”]

get camera viewing vector, which is also the normal vector of the

camera’s xy plane

cmat = camera.matrix_world
camera_z = Vector([cmat[i][2] for i in range(3)])

this is the new center of the camera view

l_0 = Vector((0,0,0))
l = camera_z
n = camera_z
p_0 = camera.location

new_loc = (p_0 - l_0).dot(n)/l.dot(n) * l + l_0

camera.location = new_loc