Complex geometry - Trajectory

Attention, the following content is about an advanced topic. Study of previous tutorials is recommended.

Movement along the trajectory - Chase camera

When animating the motion of bodies, we often need the animated body to keep the desired trajectory. Setting such a movement manually would be tedious and cumbersome, so you can use the Trajectory tool in the Complex geometry category.

Movement along the trajectory

For example, suppose we want a body to orbit a circular path of a certain radius. On the left panel on the 3D Bodies tab, select the Ellipsoid which will be our moving body and set it as follows:

  • Radius A: 1
  • Radius B: 1
  • Height Seg: 8
  • Round Seg: 16
  • Cutting angle: 360

Then we prepare a trajectory. This can be basically any series of vertices connected by edges. Condition is required to keep the trajectory with no branch.

In our case, we want the ellipsoid to move along a circular path. The easiest way to get such is from the Circle model on the 2D Bodies tab. It is necessary for the motion path to be sufficiently detailed so that we set the circle with enough segments around the circumference:

  • Radius: 10
  • Round Seg: 32

Tip: If for any reason the Trajectory tool does not cooperate with the path created from the circle, the second option is create it from Cylinder in the 3D Bodies category. Convert the Cylinder to General geometry by Ctrl+G. Select and remove the faces of both bases. Then select and remove the vertices of the remaining cylinder shell except the single edge ring. Since the original cylinder retains the beginning and end of the shell, we obtain the desired circular path that just will not be a closed loop.

Now choose the Trajectory from the Complex geometry tab of the left panel and press Create. The trajectory parameters appear at the bottom of the left panel. These are very easy. In the first parameter Trajectory, using the [...] button, select the model of our circular path from the list. In the second parameter Model, press the [...] button again to select the model to move on the path - Ellipsoid. The Trajectory tool works by creating the same number and timing keyframes for the embedded model, which corresponds to the number of vertices and proportions of the embedded path. If the path has between its vertices at one point a longer edge than elsewhere, the keyframes of the resulting animation will be proportionally offset by a longer time delay so that the motion of the animated body is uniform.

Set the motion duration from the starting frame with Start = 0 and to the end frame by Stop = 200. For example, the track may have 32 vertices, that is 32 keyframes, but due to the Start and Stop parameters, their total duration can be extended or shortened according to the user's needs. In our case it is extended to 200 frames. If the input model already has keyframes, such as change of the scale etc., we can adopt them by setting Animation parameter to Derived. Attention: The Trajectory tool, however, does not animate the model's rotation caused by path's curvature. If the user wants the model to keep its orientation still in the direction of the track, the model must be manually fine-tuned in each keyframe. Finally, the above-mentioned procedure is just a preparation of an animation for a trajectory movement. You need to press the Finish button to transform the Trajectory tool into the original input model type with all its properties, but also keep the newly created keyframes of the motion animation. Message "Attention! This operation is irreversible" pops up, so press OK. This makes it possible to animate models that needs to preserve their original parameters such as cameras, lights, etc.

Tip: We'll create a path of any shape simply with the vertices and edges editing of General geometry. Just create any basic model, convert it to General geometry with Ctrl+G and edit.

Tip: The trajectory keyframes are in the same order as the trajectory vertices. You can find the sequence number of each vertex in the label on the left panel by selecting the vertex while editing the model vertices as General geometry. However, despite that the trajectory can be expanded by further editing and inserting sections, which will disturb the vertex order, but it doesn't matter so much. It is only important that the path is continuous. When insterted the trajectory model the Trajectory tool sorts its vertices by itself from lower number to higher to follow a continuous edge path from one vertex to the next, etc.

Chase camera

Special situation occurs when we want to animate the movement of the camera and its view direction simultaneously. Therefore, you need to create two trajectory animations. One for the camera itself and the other for the point to watch during the motion.

For example, let's say we have a moving object in the scene, where the camera should always move in chase after it - a third person view. For example, this object may be a slug placed in a separate new animation. To create a new animation, select Animation - New animation...

Once we have completed the standalone animation, we can switch back to the main animation by selecting Animation - Select animation... and create an Animation in Animation object in the Complex geometry tab. In its parameters, use the [...] button to select a slug animation and set Start frame and Stop frame to play the entire slug animation. This way we have just created an object that plays any other animation while moving it in the scene as if it were a single body.

Tip: If the Animation in Animation's playback speed doesn't suit, you can edit it in the Speed parameter. Less than 1.0 means slower than the original, more than 1.0 means faster than the original.

Now we will create a motion path, that is, a model containing an non-branching series of vertices and edges, and use the Trajectory tool from the Complex geometry to create a motion of the Animation in Animation object along this path. The animated model we have obtained (the slug moving on the trajectory) can now be set to the camera as a LookAt model. If we don't have one yet, we'll create one on the left panel on the Cameras / Lights tab. If we want, we can also place the motion trajectory model a little higher than its original position, so that our camera looks at the slug slightly from above.

If everything is ready, we can finally create a second tool Trajectory, to which again assign the wire model of the trajectory as an input trajectory and insert the camera as an input model. The camera should move after the slug with a low delay. Therefore, in the Start and Stop parameters set values such as for 20 higher than the original slug trajectory. As mentioned above, this is a Trajectory model at this point, but we need the model type to return to Camera for proper camera operation. Therefore, press the Finish button to bring the Trajectory object back to the type of input model we have inserted - the camera.

Tip: If we want the camera not to look directly at the model in front of it while moving, this can be done. Create another 3D model, use Ctrl+G to convert it to General geometry and for example in vertices edit delete all its content. This will give you a blank / invisible model that can be animated by a completely different trajectory and then used as a camera's LookAt model. As a result, the camera can be animated for example as a viewer driving in a vehicle and looking around the area while driving.

If everything went well, we should now have a solid object in the scene that moves along a given path and a camera object that moves along the same path in a chase behind it. In any viewport use the arrow in the upper left corner to select View - Camera... and select the camera we just animated. When you start or render an animation you should see the resulting camera view chasing the body.

Tip: When the camera follows a body moving along a trajectory, image tearing may occur. This is affected by the number of segments on which the trajectory's curve is split. For better results you need to model a trajectory that has a finer segmentation of the curves.

<< Return to topics

Copyright (c) 2013 - 2023

General terms and conditions

End user license agreement