This example shows a workflow for prototyping 3D models in Microsoft™'s Paint 3D and using them in the Simulink® 3D Animation™ editor and viewer. This example assumes that you are working on a Microsoft Windows platform.
The example uses a variation of the UAV Competition example model, whose simulation is displayed in the 3D Animation viewer.
In this example, we will be modifying the virtual world to add a different drone exported from Paint 3D.
In Paint 3D, you can create your own model using shapes and objects in the 3D Shapes pane. This example, however, uses one of the drones from Microsoft's Remix 3D Repository.
Create your own model or import it into the Paint 3D canvas. To import a model, select 3D Library from the Paint 3D toolstrip to view Microsoft and user-contributed models to the Remix 3D repository.
When you're ready to export the model, open the Paint 3D menu by selecting Menu in the toolbar and select Save As. Choose the 3D model option in the the Save as copy section. In the Windows Save As dialog, select
FBX as the desired file type for your model.
uav_fbx_import uses the attached
uav_scene_drone_example.wrl world file to define the structure of the virtual world. Open the virtual world file in the 3D World Editor.
Select Nodes > Import From > FBX File to import the saved 3D model into the node tree as a child of the UAV_Col_Transf (Transform) node.
To quickly find the inserted body in the virtual world, right-click the name of the newly inserted node and select View Node.
You may find that the imported node is not in the right place or the right size. Update the Translation, Rotation, and Scale properties of the imported node to place the drone on the starting mat and within the bounds of the collision box defined by UAV_Col_Shape. Save the modified virtual world.
uav_fbx_import and add a new VR Sink Block. Configure the block settings to use the included
uav_scene_world_example.wrl virtual world. Select the rotation and translation properties of the Imported_FBX_Model and nodes.
Connect the outputs of the UAV Navigation & Tracing block to the ports labeled UAV.rotation and UAV.translation. The UAV (Transform) node is a direct ancestor of the imported model in the node hierarchy of the virtual world. Therefore, rotation and translation operations applied to the UAV node, affect the bounding box UAV_Col_Shape, the UAV model Imported_FBX_Model, and the primitive pick sensors that detect collision and landing of the UAV.
Simulate the model using the predefined trajectory or manually, using a SpaceMouse by switching the SpaceMouse/Predefined Navigation Switch block.
Used with permission from Microsoft.
Copyright 2019 The MathWorks, Inc.