|
Robert, your Expression, with activeCamera will result in an Expression error popup if there is no activeCamera where the Timeline Indicator is located. The Expression error may also occur when an activeCamera is present - it's a strange error. Thanks to Dan Wilk from plabt, I'm now able to use the try/catch routine to overcome Expression errors such as this.
Here's the script you amended from DanE's, with the try/catch statements -
//start script
cam = false;
try {cam = thisComp.activeCamera; }
catch (err) {};
if (cam == 1) {
v = cam.toWorldVec([0,0,1]);
lookAt(position,position+v)
} else {
value
// set value to what you want should the Expression result in an error ie activeCamera is false
}
//end script
HTH
- Roland Kahlenberg
* LATEST AE Workshop * http://www.broadcastGEMs.com/MediaScreamer01/bGEMs_MoGraphIntensity_Promo_MG01_18Nov_2013_VBR4_01.mp4
Intensive mocha & AE Training in Singapore and Other Dangerous Locations
Imagineer Systems (mocha) Certified Instructor & Adobe After Effects ACE/ACI CS6
http://www.broadcastGEMs.com/training
----- Original Message -----
From: "Robert Kjettrup" <robert@stvmayday.dk>
To: "After Effects Mail List" <AE-List@media-motion.tv>
Sent: Saturday, December 21, 2013 11:14:59 PM
Subject: Re: [AE] Expressions: Somewhere between Auto Orient and Auto Orient Y only
i had the same exact problem a few weeks ago, and i hacked together an expression to do it. It actually does the same as Dan E's version, but ofcourse Dan's is much more elegant, simpler and works with the camera as a child under a null, something i struggled to get to work in my version :-D
thanks Dan for this, i will save that as an animation preset... with one small adjustment, adding support for the active camera:
cam = thisComp.activeCamera;
v = cam.toWorldVec([0,0,1]);
lookAt(position,position+v)
and for anyone interested, here is my simple much worse version that breaks if the camera is parented:
cam = thisComp.activeCamera;
fromPoint = cam.position;
atPoint = cam.pointOfInterest;
lookAt(fromPoint, atPoint)
DONT USE this :-D
and my expression for making it work under nulls was more complicated and needed 2 extra nulls for the expression to look to. I couldnt get .toWorldVec to work with the cameras position and target, only with nulls.
Happy Holidays to all on the AE-list.
Robert
|
|