Documentation

从涂料进口FBX模型3 dinto a Virtual World

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.

Create 3D Model Using Paint 3D

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 the3D Shapespane. This example, however, uses one of the drones from Microsoft's Remix 3D Repository.

创建自己的模型或将其导入涂料3D画布。要导入模型,请选择3D库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 selectingMenuin the toolbar and selectSave As。选择3D modeloption in the theSave as copysection. In the WindowsSave Asdialog, selectFBXas the desired file type for your model.

Import FBX Model into Virtual World

Theuav_fbx_importuses the attacheduav_scene_drone_example.wrlworld file to define the structure of the virtual world. Open the virtual world file in the 3D World Editor.

SelectNodes>Import From>FBX File将保存的3D模型导入节点树作为一个孩子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 selectView Node

You may find that the imported node is not in the right place or the right size. Update theTranslation,Rotation, and规模properties of the imported node to place the drone on the starting mat and within the bounds of the collision box defined byUAV_Col_Shape。Save the modified virtual world.

Display Simulation Using Imported Model

Openuav_fbx_importand add a new VR Sink Block. Configure the block settings to use the includeduav_scene_world_example.wrlvirtual world. Select therotationandtranslationproperties of theImported_FBX_Model和节点。

Connect the outputs of the UAV Navigation & Tracing block to the ports labeledUAV.rotationandUAV.translation。TheUAV (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 theUAVnode, affect the bounding boxUAV_Col_Shape, the UAV modelImported_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.

See Also

UAV Competition Example

Used with permission from Microsoft.

Copyright 2019 The MathWorks, Inc.