Main Content

从油漆3 d FBX模型导入到一个虚拟的磨破ld

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.

Create your own model or import it into the Paint 3D canvas. To import a model, select3D Libraryfrom 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. Choose the3D modeloption in 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保存的3 d模型导入节点树a child of theUAV_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, andScaleproperties 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_Modeland nodes.

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.