I have a layer whose distance I want to change, moving along along its current vector.

var cam = thisComp.activeCamera;

delta=sub( cam.toWorld([0,0,0]), this.toWorld(this.anchorPoint) );

var dist = length(delta);

delta represents the vector between the layer and the camera, and dist represents the distance. What I'd like to do is to be able to change the distance to a specific value, but reposition the layer along the delta vector, so it would essentially be moving directly toward or away from the camera.

This is a big gap in my understanding of vectors and such. Would I need to use trig functions, or cam.toWorld? My gut tells me it might require matrix math, which I don't get in EMCA script at all.

Any help is greatly appreciated.

Robert Womack

Creative Bridgekeep

http://www.CurrentMarketing.com
"Louisville's Leading Interactive Marketing Agency"