6
$\begingroup$

I want to place a spot light right where my camera is and at the same orientation.

If I wanted to place, for example, a spotlight where a cube is and in the same orientation that I can easily do but I am stumped to how to do that with matching the angle of a camera.

So I place the 3D cursor at the active object, in this case the camera, but all the surface orientation or other option don't work. I tried every combination. I can't get the orientation to match the camera's angle.

How do I rotate the 3D cursor to match the rotation of a camera?

$\endgroup$
1
  • $\begingroup$ good question -- not sure how to rotate the cursor as i tried to change transform orientations to camera local then Snap "cursor to active" to with no love.... But workaround: add spot, multi-select to add camera and use Align Tools to align position and rotation ... did the trick for me. could perhaps be scripted. some things should just be easier and more intuitive (says this software engineer)! $\endgroup$ – james_t Feb 11 at 14:22
6
$\begingroup$

You can also do this without any addon :)

  1. Select Camera
  2. Object > Snap > Cursor to selected (Shift+S)
  3. Look through your camera (View > Active Camera) (Numpad 0)
  4. Add your spotlight and choose Align > View

enter image description here

$\endgroup$
3
  • $\begingroup$ I think I tried this and it didn't work but probably because I didn't do the NUM 0 $\endgroup$ – Eric Huelin Feb 11 at 15:42
  • $\begingroup$ You still have to place the 3D cursor at the camera then follow your steps. $\endgroup$ – Eric Huelin Feb 11 at 15:45
  • 1
    $\begingroup$ Everything is at the origin in this example, so it worked automatically :p Thanks for the feedback, feel free to submit an edit Eric. $\endgroup$ – Allen Simpson Feb 11 at 17:40
4
$\begingroup$

You don't need to rotate the cursor, just select the light, add camera to selection making it the active object and in search menu(F3) type Align to find Align Selected To Active:

enter image description here

You need Align Tools addon enabled in the preferences. Search for it in Edit -> Preferences -> Add-ons tab

enter image description here

$\endgroup$
5
  • 1
    $\begingroup$ Sorry, my bad. Did not realize this comes from Align tools addon that you need to enable in the preferences. $\endgroup$ – Martynas Žiemys Feb 11 at 14:33
  • 1
    $\begingroup$ There is another guy with the exact same name as you who says native functionality is sufficient. :D $\endgroup$ – Eric Huelin Feb 11 at 14:35
  • $\begingroup$ That was me :D It was a mistake. $\endgroup$ – Martynas Žiemys Feb 11 at 14:35
  • $\begingroup$ Blender Developers need to add this kind of functionality as standard. $\endgroup$ – Eric Huelin Feb 11 at 14:42
  • 1
    $\begingroup$ I think this question is now only lacking a solution with nodes for fun. $\endgroup$ – Martynas Žiemys Feb 11 at 15:26
3
$\begingroup$

No need for a python console. Select the spotlight, add two constraints: Copy Location and Copy Rotation. Set the camera as Target in both constraints.

This way the spotlight follows your camera even if it's animated and always points in the direction the camera is 'looking'.

Of course you can simply set the spotlight itself as camera by selecting it and pressing Ctrl+0, but I think you don't have camera settings for the spotlight.

$\endgroup$
2
$\begingroup$

Python Console.

For even "more fun", can use the python console.

Align the cursor to scene camera.

>>> C.scene.cursor.matrix = C.scene.camera.matrix_world

enter image description here Please note: running the code above, setting the matrix, shows the correct results in 3D Cursor properties, but does not update its location in the 3D View enter image description here However, running an add object operator directly after, and aligning object to 3D cursor, snaps it to set transform.

cursor to active object

>>> C.scene.cursor.matrix = C.object.matrix_world

active object to camera\

>>> C.object.matrix_world = C.scene.camera.matrix_world

EDIT.

Despite all the claims of "no need" for this and that, currently IMO this is only answer to

How do I rotate the 3D cursor to match the rotation of a camera?

so far. Albeit that this is the XY Problem of the desired result.

I want to place a spot light right where my camera is and at the same orientation.

$\endgroup$
0
$\begingroup$

Add spot light, multi-select to add camera to selection and then use the "Align Tools" to align position and rotation

$\endgroup$
1
  • $\begingroup$ Oh, I didn't even realize, this comes from the addon $\endgroup$ – Martynas Žiemys Feb 11 at 14:32

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.