2
$\begingroup$

I'm new to Blender. I wrote a Python script where I sequentially read the camera poses from a csv file (real user traces), move the camera accordingly and render the scene. In my scene, there is a virtual object but for each camera trace, orientation of the camera is different so I have to manually re-adjust the position of the virtual object for it to fall within the camera viewport.

How can I set the location of the object automatically, depending on the camera orientation? Assume a constant distance between the camera and the object, I just want to adjust the orientation.

$\endgroup$
2
$\begingroup$

Just parent your object to the camera (adjust the position one time manually) and it will stay forever in the middle.

Like this:

enter image description here

result:

enter image description here

$\endgroup$
2
  • $\begingroup$ What if I want to do this only once at the beginning? I want to put the object in the center of the camera viewport for the first camera position and then not move it again. Similar to "Align active camera to view" but the other way around, i.e. align the object to the active camera. Can I do this using the Python APi? $\endgroup$ Dec 2 '21 at 10:57
  • $\begingroup$ you could add a child of constraint instead of parenting it. Then you can animate the influence value. If my answer helped you, please check the checkmark left to my answer. If you have other/further questions, please open a new question. Thanks. $\endgroup$
    – Chris
    Dec 2 '21 at 12:48

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.