Create a Dynamic Camera
Start a New Camera Definition
If you are new to dynamic cameras, see Visualization Cameras. To start a new dynamic camera:
Simulate the model that you want to add the camera to.
Dynamic cameras exist only in the models that you define them in.
In the Mechanics Explorer menu bar, select Tools > Camera Manager.
Camera Manager opens with a list of previously created dynamic cameras. The list is by empty until you create your first camera.
In Camera Manager, click the button.
Camera Manager switches to a camera definition view that lets you select the camera mode and specify the camera motion.
In the Camera Name field, enter a name for your camera.
Make the camera name descriptive so that you can later identify it when selecting an active camera from the Mechanics Explorer visualization context-sensitive menu.
Complete the camera definition by selecting the camera mode and specifying the camera motion. See:
Define a Keyframes Camera to define the camera motion in
Keyframes
mode. Keyframes are viewpoints that you specify at various playback times and that Simscape™ Multibody™ software interpolates to obtain smooth camera trajectories.Define a Tracking Camera to complete the camera definition in
Tracking
mode. Tracking constraints include position, aim, and up vector constraints that you specify relative to coordinate frames in a model.
Define a Keyframes
Camera
In Camera Manager, set the Mode parameter to
Keyframes
.Camera Manager switches to a
Keyframes
view that lets you define the camera keyframes.In the Mechanics Explorer toolstrip, set the playback time for the current keyframe.
Drag the playback slider to the desired point in the animation timeline. Alternatively, enter the time directly in the playback time counter.
In the visualization pane or tile, manipulate the model viewpoint for your keyframe.
Use the Rotate, Roll, Pan, and Zoom buttons to manipulate the model viewpoint. Use the preset view buttons to obtain standard views such as front, side, or isometric.
In the Camera Manager
Keyframes
window, click the Set button.Playback must be paused or stopped. Camera Manager commits the keyframe to the camera. The playback slider identifies the keyframe with a colored line marker located at the specified playback time.
Set new keyframes as in steps 2–4 until you are satisfied with the camera motion.
Simscape Multibody software transitions between keyframes using the smooth interpolation method of the
pchip
MATLAB® function to yield the final camera motion.Click the Save button in the camera definition and main panes of Camera Manager.
Camera Manager saves the camera and its motion to the model. The visualization context-sensitive menu adds the camera to the list of available cameras.
To edit an existing keyframe, use the Previous and Next buttons to navigate to the keyframe you want to edit. Then, repeat the procedure for adding a keyframe. Use the colored markers in the playback slider to identify the existing keyframes in your dynamic camera.
Click the Remove button if you want to delete the current keyframe. Click the Save button in the main pane to commit your changes to the camera.
Define a Tracking
Camera
In Camera Manager, set the Mode parameter to
Tracking
.Camera Manager switches to a
Tracking
view that lets you define the camera constraints—position, aim, and up vector—relative to frames in your model.In the Camera Manager tracking window, set the camera Position, Aim, and Up Vector constraints:
In the tree view or visualization pane, select a frame to constrain the camera to.
If using the visualization pane, click a frame icon. If using the tree view pane, click a frame node. It is not enough to click the body that the frame belongs to.
Click the Use Selected Frame button to constrain the camera motion to the frame.
If you accidentally select the wrong frame, pick a new frame and click the Use Selected Frame button again.
For the Aim and Up Vector dropdown lists, select how to constrain the camera:
The Position constraint fixes the camera to the frame origin only and has no options dropdown list.
The Aim constraint provides the option to aim the camera at the frame origin or along a selected frame axis.
The Up vector constraint provides the option to align the up vector along a selected frame axis.
Select a Dynamic Camera
The dynamic cameras that you create through Camera Manager are by default inactive during animation playback. To set a particular camera as the active camera for a visualization pane, use the visualization pane context-sensitive menu. You can perform this task separately for each visualization pane that you have open in Mechanics Explorer:
Right-click the visualization pane or tile whose camera you want to switch.
The visualization context-sensitive menu opens up.
Select Cameras and, from the cameras list, select the desired camera.
The model viewpoint switches to that provided by the selected camera.