Activity › Forums › Adobe After Effects Expressions › Camera follows path and orientates to the path
-
Camera follows path and orientates to the path
Posted by David Chaudoir on June 11, 2009 at 6:25 pmI have illustration is of a slot car/scalextric track with zig zags and curves.
So I bring that in from Illustrator. Then I copy a path that emulates the track shape.
I don’t know how to use this data to achieve the effect I am afterwhich is:
I want the camera to hover over the illustration at a low angle – ie as if it is the slot car’s POV just above the track and race around the track…
Any expressions/tutorials hints etc gratefully received!
Robert Benson replied 15 years, 1 month ago 3 Members · 3 Replies -
3 Replies
-
Kevin Camp
June 11, 2009 at 10:11 pmthis can get a bit tricky (or maybe i’m over thinking it) but i’ll try to explain how to do this…
it sounds like you have copied and pasted a path form illustrator onto a solid in ae… now try to copy and paste that mask path into the position property of a 2d null (name it ‘2d Path’)… the mask points should be seen as keyframes for the null’s position and it should now follow the path as you scrub through the timeline. you can hide that null, we’ll use that 2d position data for the camera movement later.
i assume you want the track to be the floor, so make the track layer 3d and rotate it so the x rotation is -90.
to get a camera to follow that path, we’ll need to change the 2d xy data to the xz plane. to do this it might be easier to set up 2 cameras, call the topmost camera ‘setup’ and the other camera ‘main’ (ae will only use the topmost active camera, which will help us in set up). set the main camera’s position to 0,10,0 (you’ll be able to tweak these values later) then add this expression:
L = thisComp.layer(“2d Path”);
x = L.transform.position[0];
z = L.transform.position[1];
value + [x,0,-z]i found that adjusting the camera’s z position to half the track layer’s height put the camera on the track, you may need to find a value that works for your file. you can adjust the y value to get the camera above the track. you can use the camera orbit tool to adjust the main camera to get a better view of what’s happening if needed.
next you’ll want to attach the point of interest to the track, just in front of the camera. add an expression for the main camera’s point of interest and enter this:
offset = 2; // value in frames
L = thisComp.layer(“2d Path”)
poi = L.transform.position.valueAtTime(time+(offset*thisComp.frameDuration));
x = poi[0];
z = poi[1];
value + [x,0,-z];again, you’ll want to adjust the poi z value to the same value as the main camera’s position value (about half the track layer’s height). you can adjust the poi y value as needed. the offset is how many frames in front of the camera the poi is getting data from, tweak that as needed.
with the main camera selected and the setup camera active, you should see the camera tracking around your track. if it seems like it is, hide the setup camera and the preview should switch to the main camera, you can make further tweaks from there.
i think this will get you close to what you are looking for.
Kevin Camp
Senior Designer
KCPQ, KMYQ & KRCW -
David Chaudoir
June 12, 2009 at 7:38 amThanks Kevin
Due to the time lag I have only just seen your response – many thanks for this. It looks very thorough.
Regards
David
-
Robert Benson
March 25, 2011 at 2:21 amHello Thanks for the 3d camera raod tips- I followed the instructions STEP BY STEP … it did not work- by the layer height do you mean the y axis? can you post a final project – or clarify your directions… thank Robert
Reply to this Discussion! Login or Sign Up