Script to automate rigging a camera in After Effects

final update July 15, 2006

Added a new Point of Interest expression instead of dealing with the Auto-Orient dialog as detailed in the comments.

second update July 14, 2006

Chris Prosser suggested a decent workaround of using app.executeCommand(app.findMenuCommandId(”Auto-Orient…”)) to auto-launch the Auto Orient dialog. Which in my opinion makes the script pretty usable, even with the slider range problem. Right now, I’m launching a dialog that reads “Auto Camera Rig” needs to have Auto-Orient set to “Off”, please set it in the following dialog and then immediately launching the Auto-Orient dialog. I’d be interested in feedback on whether I should leave the two dialog boxes for context or use a saveSetting() preference to give the user a Never Show Again option as well as Ok. Power users could always just comment out the alert line. Scripting UI’s are always difficult for me, I think I know how I’d handle it in a regular mac app, but I’m not so sure how to handle it here.

update July 14, 2006

Stu Maschwitz pointed out some deficiencies with the original version of this script and provided a sample project of a much better implementation of a rigged camera project. Unfortunately, there seem to be a couple of show stoppers for recreating his project via scripting and I’d love some feedback if anybody has worked through these issues, and if not I’ll send them off to The first is the addCamera() method assumes a point of interest in its constructor. That seems to make the UI equivalent of layer:transform:Auto Orient:Off impossible. I’ve tried setting the property to Null, etc. with no success. Interestingly, there is a useful assistant to set the property. Secondly, I can’t seem to set the slider control range via scripting. I can set the value but not the range so this may be less of a show stopper than the first. I’ve uploaded the changes that reflect Stu’s sample project, so if you find running the script then turning Auto orient off (command-option 0, on the Mac..control-alt 0, windows? I don’t have a Windows box handy), and can live with the slider range limitation, then great. Send any fixes my way and I’ll incorporate them. I think I see why nobody took this one on .

I was doing a bit of research and ran across Kyle Sim’s request to automate his process of rigging an After Effects camera on aenhancers and the adobe forums. Seemed like a really useful script and as near as I can tell nobody has tackled it, so I decided to give it a shot.

Usage is really straight forward, copy the script to After Effects:Scripts and run it from the scripts menu with an active Comp selected. I’m not doing any layer name checking because I think it’s possible that you might want more than one camera and null, although we’d have to adjust the expressions accordingly.

When I run the script my effect window for the Mover Null looks like this and it does a great job of making the camera move really straight forward.

Null Effect Controls from automated camera rig script for After Effects

You’ll have to thank Kyle or whoever set up the original expressions for the idea, this just automates the creation of the rig.

Update 04.21.2007

Paul Tuersley kindly updated this script with some cool new features.

I've attached an update to your db_autoCameraRig script. 
I've added a  check for AE8 which then automatically 
turns of Auto-Orient. 
I also  streamlined the bit that sets  the position / POI 

Here’s Paul’s new script, and I’ve left the original up as a legacy 1.0 version in case we get any problems out in the field.
JSX script With Paul’s Improvements
Original Source JSX script
Update 06.10.2007
Paul kindly sent me additonal updates to his modification of the script.
Paul writes…

I’ve tweaked how this version deals with the Auto-Orient issue, which
you may want to check out. In AE6.5 it puts up an alert to tell you
to turn Auto-Orient off, in AE7 it does the same and then opens the
Auto-Orient dialog and in AE8 it turns Auto-Orient off automatically.
I also added expressions to all the properties you shouldn’t alter,
effectively locking them.

Thanks Paul.

Paul’s lates modifications – JSX script in a zip archive


  1. Stu said

    Hi Dale,

    I don’t think you’ll enjoy animating that camera very much. If you pan and tilt you’ll notice that the horizon becomes unlevel. That’s because the 3D roation order in AE is wrong for a camera. Try this project: (7.0 only)

    It uses parenting to solve the rotation order issue and adds sliders for focal lenth and image plane sizes.

    If you decide to try to script this camera, note that the camera itself has Auto Orien switched off. Also note that it would be ideal to range the X slider from 0 to the comp width, and the Y slider from 0 to comp height. Not sure if you can set slider ranges with scripts, but if you can’t, we need to request that feature.

    Hope this project provides a fun new challenge for you!


  2. Dale said

    Thanks for the feedback Stu… ahh, I see what you mean.

    That’s what I get for taking on what seemed like a straight forward script, but it wouldn’t be any fun without a few twists and turns.

    Let me dig into your sample project and see if I can make those adjustments.



  3. Chris Prosser said

    Still not great…but you can at least put up the Auto Orient dialog with:


    to make it harder to forget.

  4. Dale said

    Hey Chris,

    Thanks for the feedback. You’re right that’s a pretty decent workaround. I’ll make that change.


  5. Stu said

    Hey guys,

    You know, my rig will still work with Auto Orient set to Point of Interest (the default) — just add this expression to the Point of Interest stream:

    position + [0,0,100]

    Man, your screenshot of the sliders reminds me of how much I HATE those stupid Animation Preset pop-ups. They are so lame. I always turn them off — see:


  6. Dale said

    Hey Stu,

    I’ve added the pointOfInterest expression.

    I see what you mean about the animation preset being a pain. I’m not at my usual workstation today, so this is a default install, I’ll have to get everything configured soon.


  7. Stu said

    Looks great Dale. The only thing that could improve it would be ranging the sliders to more intuitive values. Is that possible with scripting? Maybe rename “Null 1” to something like “Camera Control” while you’re at it?

    Picky picky… thanks for rising to the challenge!


  8. Dale said

    Hey Stu,

    I seem to be limited on the Slider Control range. I’m going to send that one off to

    I could, however, block the max and min values in the expressions. Should the max and min match the range of the slider control in the sample project?

    The layer name should be Camera Control, can you check if you’ve got source name selected instead of layer name? Jeff pointed that one out to me on another script and I did a big Doh! If it still isn’t named correctly, I’ll check the script, but I’m pretty sure I can change the Null name if necessary.


  9. Kyle said

    Hey Just came across this – i was the one that made the original request – so thanks a million!

  10. Dale said

    Hey Kyle,

    Glad you tracked it down!


  11. Steve said

    I’m looking for a solution to the problem of losing motion paths for cameras when their position is controlled by expressions/parenting.

    Separating the keyframes for x,y and z pos. via a camera rig such as this is a great way of making smooth camera movements. But because the keyframe data is stored in effects parameters rather than postion values, you have no visible motion paths, and hence animating along irregular curves is difficult.

    My current method is to simply parent the camera to a null and animate Y rotation and usually one position value (Y for a ‘landscape’, Z for a ‘wall’) on the null. I then animate X and Z rotation and the other position values on the cam itself.
    This corrects the ‘wrong’ rotation calculation order, and leaves me with a 2D motion path and a separate ‘trim’ control. It’s far from perfect, especially when I need a truly 3D motion path which swoops in all three planes.
    AE CS3 now shows you separate xyz values in the graph editor, a slight help, but you can’t keyframe them separately which can still cause untold headaches. In C4D you can make a Y only keyframe, go to top view and you can’t move it – it has no X or Z value to alter. Yet go to perspective view and you can slide it up and down, altering the motion path shape. The control handles behave similarly – you can’t drag them into a plane that isn’t also keyframed (hope that makes sense).

    Or maybe I should just do all my animation in C4D. I’ve only been using it a month and it’s helping me see a few shortcomings in AE’s implementation of 3D.


  12. […] Paul was also kind enough to send me his upgrades and update to my Auto Rig Script for After Effects. I’ve posted his version of the script and I hope to make his changes permanent once I can get some field testing of it working out in all situations. So, I’d appreciate it if you’d download it and give me feedback if you have any issues. […]

  13. gobomus said

    so why would you even want that kind of complex setup for a camera???

  14. Kyle said

    gobomus – you’ll know when!

    But thankfully this is all pretty much moot with AE CS4 anyways.

  15. Peter said

    I’ve tried to use the script with the rig, but everytime I get the same error when I try to apply the script to the active comp :

    Unable to execute script at line 51, Null is not an object.

    what am I missing?

  16. Dale said

    Hey Peter,

    Which version of AE are you using?


  17. Peter said

    Figured it out … I was selecting the camera AND the Controller together before applying the script.

    It works now. Thanks!

  18. laurence said

    Can i just ask, why was the ability to adjust the x,y,z position on the slider control barred??? This makes no sense?

  19. […] was also kind enough to send me his upgrades and update to my Auto Rig Script for After Effects. I’ve posted his version of the script and I hope to make his changes permanent once I can get […]

RSS feed for comments on this post

Comments are closed.