Create a Model Animation Video
UI and Command-Line Tools
You can create a model animation video interactively, using
the Video Creator tool, or
programmatically, using the
The tool and function provide equivalent ways to perform the same
task. Use the tool to more intuitively configure and create a video.
Use the function for your command-line workflows, e.g., to automate
video capture following model simulation.
Before Creating a Video
Mechanics Explorer must be set to open on model update.
You can view and change the current setting in the Simscape Multibody > Visualization tab of the Model Configuration Parameters window.
Only the active visualization tile in Mechanics Explorer is recorded.
A visualization tile is a subdivision of the Mechanics Explorer visualization pane that shows a specific view of the model. The active tile is demarcated by a colored bounding box.
The video viewpoint is always that of the active tile.
To change the model viewpoint in the recorded video, you must change the viewpoint of the active tile. Use a dynamic camera for a moving point or the global camera for a static viewpoint.
Create a Video Using Video Creator
Simulate the model to record.
Animations and the videos generated from them are based on your model simulation data.
In Mechanics Explorer, select Tools > Video Creator.
Video Creator relies on your model visualization and is accessible through Mechanics Explorer only.
In Video Creator, specify the desired video parameters.
Video parameters that you can modify include the video frame rate, frame size, playback speed ratio, and video file format.
Click the Create button.
Video Creator generates a model animation video and saves it with the specified name in the specified folder.
Save the model animation video in a folder for which you have write privileges.
Create a Video Using
Simulate the model to record. E.g.,Simscape™ Multibody™ software simulates the dump trailer featured example.
modelName = 'sm_dump_trailer'; sim(modelName);
Define any video parameters that deviate from your current Video Creator settings. E.g.,All remaining video parameters are configured as specified in Video Creator.
fps = 60; speedRatio = 2;
Define the desired name and path of the animation video.In the absence of a path, the function saves the video in the current folder. You must have write privileges to the folder in order to save the video.
videoName = 'dump_trailer_animation'
smwritevideofunction with the video name and parameters as function arguments.The
smwritevideofunction creates a video of the model animation and saves it with the name
dump_trailer_animationin the current folder.