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

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?

• 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)! – james_t Feb 11 at 14:22

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

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

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:

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

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

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.

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


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 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.

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

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