Visualization Cameras
Camera Types
Cameras define the model viewpoints used during animation playback. Mechanics Explorer supports two camera types—global and dynamic. The global camera provides a static viewpoint that you can manipulate interactively during animation playback. Dynamic cameras provide moving viewpoints that you predefine using Camera Manager.
Camera in a Model
The moving viewpoint of a dynamic camera enables you to more easily track the motion of a system. You can use a dynamic camera to keep a moving vehicle such as an automobile or aircraft in view during animation playback. You must define and select a dynamic camera in order to use it in a model. See Create a Dynamic Camera.
The figure shows a model visualization captured from the view point of a dynamic camera. This
model is part of the Configuring Dynamic Cameras - Vehicle Slalom featured example. You can open the model from
the MATLAB® command prompt by entering
OpenExample('sm/DynamicCamerasExample)
.
Example of a Visualization Captured with a Dynamic Camera
Global Camera
The global camera is a static camera that:
Has no planned trajectory.
You must manipulate the camera manually to change the camera viewpoint, for example, by using the Pan, Rotate, Roll, and Zoom buttons.
Is external to the model.
You cannot position the global camera between bodies, for example, to prevent one body from obstructing another during animation playback.
Uses an orthographic projection.
Apparent body sizes remain constant regardless of object distance to the camera. This effect, shown in the figure, is consistent with a camera located relatively far from the model.
The global camera is the default camera for all model visualization tiles—each a subdivision of the model visualization pane, when split. In the absence of custom dynamic cameras, the global camera is the only camera available in a model.
Dynamic Cameras
Dynamic cameras are custom cameras that:
Have planned trajectories.
Every dynamic camera follows a trajectory that you prespecify through Camera Manager. You cannot use the Pan, Rotate, Roll, or Zoom buttons during animation playback.
Can be internal to a model.
Dynamic cameras can be inside or outside the perimeter of a model. Position a camera between bodies for a viewpoint internal to the model.
Use a perspective projection.
Apparent body sizes vary noticeably with object distance to the camera, creating a more realistic 3-D effect. This effect, shown in the figure, is consistent with a camera located relatively close to the model.
Camera Trajectory Modes
Camera Manager provides two dynamic camera modes that you use to define the camera trajectories:
Keyframes
— Set the camera viewpoints at various playback times. Each viewpoint constitutes a keyframe. During playback, the camera transitions between the keyframes using the smooth interpolation method of thepchip
MATLAB function. Use this camera mode to obtain camera trajectories independent of any components in your model.Tracking
— Constrain the camera position, aim, and up vector to coordinate frames in your model. During playback, the camera moves with the frames it is constrained to, translating and rotating as needed to satisfy the specified constraints. Use this camera mode to track frames and bodies during playback.
Dynamic Camera Selection
To visualize a model using a dynamic camera, you must first select that camera. To do this, Mechanics Explorer provides the list of available cameras in the visualization pane context-sensitive menu. Right-click the visualization pane to open the menu and select Camera to select from the list.
Dynamic Camera Reuse
Dynamic cameras exist only in the models they are defined in. The camera trajectories are based on model-specific frames or viewpoints and are not transferable to other models. You cannot move, copy, or reference a dynamic camera outside of its model. To use a camera in a different model, recreate the camera in that model.