2
$\begingroup$

I recently made a drone in blender and i want to make an animation while it flies. There i have a problem because the camera stays in one place and i want it to move with the drone so can anyone help me out.

$\endgroup$
  • 2
    $\begingroup$ You should parent the camera to the drone. Select the camera and select the drone (both, in this order so that the last is active and will be the parent of the selection) then Ctrl+P. $\endgroup$ – lemon Mar 7 '17 at 9:29
  • 1
    $\begingroup$ if you need to let the camera to just follow the drone, a simple parent will do but, depending on your desired camera movements, you'll need to add something more to the camera (or else): maybe some constraint, maybe some animation of its own... think of it as if it was a real camera. how should it move, where should it look? and when. $\endgroup$ – m.ardito Mar 7 '17 at 12:19
5
$\begingroup$

A camera in the real world rarely tracks directly onto the subject - it will typically lag behind the motion of the subject so that the faster the subject moves, the further the camera will become out of position before it can catch up and the nearer to the edge of the frame it will be. We can emulate this effect by tracking the camera to Empties that follow behind the object rather than to the object itself.

Add two Empties to the scene - one will be the point the camera is pointing at (target), the other will be the 'ideal' position of the camera (goal). The 'goal' can be parented to the object so that it stays at a fixed position in relation to the object being tracked - in this way the camera can be made to follow the object at a fixed distance and direction. A Track To constraint on the camera will point it at the 'target' Empty.

Track To Empty

Drivers will be used to re-position the camera and the 'target' on each frame.

To achieve this, select the 'target' Empty, right-click one of the Location fields in the properties panel (N) and select 'Add Drivers'. Open a Graph Editor window and change the mode to 'Drivers' - you should see the three drivers for the X, Y, Z location. For the X Location, the default 'var' variable should already default and set to Transform Channel for X Location - set the 'Object' to the object being tracked. Create a second variable named 'self' and similarly set to Transform Channel and X Location - set its 'Object' to the 'target' Empty. Set the driver expression to '(var + self * 4)/5.

NOTE : To enable driver expressions you may need to go into File/User Preferences/File and enable Auto Run Python Scripts.

Drivers

Repeat for each of the Y and Z locations, changing the Transform Channel to the relevant channel in each case (ie, Y Location for 'Y' and Z Location for 'Z').

The expression (var + self * 4)/5 calculates a point that is 1/5th of the way between the Empty and the object being tracked and the Empty will now move to that calculated position on each frame. This will mean that the Empty will gradually move towards the object being tracked and will lag behind the object as the object moves.

Moving the object using keyframes should now result in the camera tracking to the object with a slight lag when you run the animation. The lag will be greater the faster the object is moving.

Set up similar drivers for the Camera (ie, select Camera, right-click a Location property, Add Drivers, go into the Graph editor and set up the drivers with Object set to the 'goal' empty (var) and the Camera (self)).

To increase the lag in the calculated postions you can adjust the calculation - for example '(var + self * 9)/10' will move it 1/10th of the distance, '(var + self * 19)/20' would move it 1/20th of the distance - so it would take much longer to reach the goal.

If you now run the animation you should find that the camera attempts to move with the tracked object and attempts to keep it in the centre of the shot.

Animated

NOTE : As the object positions are calculated 'on-the-fly' you can get unexpected results if the frame number jumps forward/backward or blender calculates sub-frames (as the calculated positions will still move as if a single frame has advanced). Therefore, it's a good idea to Bake the animation prior to rendering by selecting each of the 'dynamic' objects in turn (ie, the 'target' Empty and the Camera) and go to Object/Animation/Bake Action in the 3d-view menu. Once baked to keyframes you should disable the drivers by clicking the image of a speaker in the Drivers view.

Bake Action Silence Drivers

Blend file attached

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.