Main Content

Prepare Custom UAV Vehicle Mesh for the Unreal Editor

This example shows you how to create a vehicle mesh that is compatible with the project in the UAV Toolbox Interface for Unreal Engine® Projects support package. You can specify the mesh in the Simulation 3D UAV Vehicle block to visualize the vehicle in the Unreal® Editor when you run a simulation.

Before you start, install the UAV Toolbox Interface for Unreal Engine Projects support package. See Install Support Package for Customizing Scenes.

To create a compatible custom vehicle mesh, follow these workflow steps.

Step

Description

Set Up Bone Hierarchy

In a 3D creation environment, set up the vehicle mesh bone hierarchy and specify part names.

Assign Materials

Optionally, assign materials to the vehicle parts.

Export Mesh and Armature

Export the vehicle mesh and armature in the .fbx file format.

Import Mesh to Unreal Editor

Import the vehicle mesh into the Unreal Editor.

Set Block Parameters

Set up the Simulation 3D UAV Vehicle block parameters.

Note

To create the mesh, this example uses the 3D creation software Blender® Version 2.80.

Set Up Bone Hierarchy

  1. Import a vehicle mesh into a 3D modeling tool, such as Blender.

  2. To ensure that this mesh is compatible with the animation components in the UAV Toolbox Interface for Unreal Engine Projects support package, use this naming convention for the vehicle parts in the mesh.

    Location of UAV rotor blade, motor, body, camera arm, and camera piot point

    Vehicle PartName

    UAV body

    UAV_Body

    UAV motor

    UAV_Motorn

    UAV rotor blade

    UAV_Rotorn

    Camera pivot point

    UAV_CameraPivot

    Camera arm

    UAV_CameraArm

    For each motor-rotor pair, n corresponds to the numbering of each pair, with a maximum number of 6.

    Note

    After the mesh is imported to Unreal Engine, the rotor blades will rotate at a fixed RPM relative to the motors. Other parts, such as motors, camera arm, and camera pivot point will remain stationary relative to the UAV body.

  3. Set the UAV body object, UAV_Body, as the parent of the other UAV objects.

  4. Set each UAV_Motorn objects as the parent of the corresponding UAV_Rotorn object.

  5. Set the UAV_CameraArm object as the parent of the UAV_CameraPivot object.

The bone hierarchy is illustrated in the following diagram.

Bone hierarchy of UAV mesh

You do not need to create all parts in your UAV. However, each child part must have the corresponding parent part in the hierarchy. For instance, if you want to use a rotor blade in your UAV, you must also create the corresponding motor as its parent.

Assign Materials

You can optionally assign material slots to the vehicle parts. In this example, the mesh uses one material for the body, one for the six motors, and one for the six rotors.

  1. Create and assign material slots to the vehicle chassis. Confirm that the first vehicle slot corresponds to the UAV_Body object.

  2. Create and assign material slots to the motors.

  3. Create and assign material slots to the rotors.

Export Mesh and Armature

Export the mesh and armature in the .fbx file format. For example, in Blender:

  1. On the Object Types pane, select Armature and Mesh.

  2. On the Transform pane, set:

    • Scale to 1.00

    • Apply Scalings to All Local

    • Forward to X Forward

    • Up to Z Up

    Select Apply Unit.

  3. On the Geometry pane:

    • Set Smoothing to Face

    • Select Apply Modifiers

  4. On the Armature pane, set:

    • Primary Bone Axis to X Axis

    • Secondary Bone Axis to Z Axis

    Select Export FBX.

Import Mesh to Unreal Editor

  1. Open the Unreal Engine AutoVrtlEnv.uproject project in the Unreal Editor.

  2. In the editor, import the FBX® file as a skeletal mesh. Assign the UAV_Skeleton asset to the Skeleton parameter.

    In the FBX import options, enable the Skeletal Mesh option in the Mesh section. In the skeleton parameter, browse for uav and select the UAV_skeleton. In the material section, set the search location to Local and Material Import Method to Create New Materials

  3. Open the imported skeletal mesh asset. Open the Asset Details tab. Select the material slot corresponding to the UAV body, and rename the slot name to VehicleBody.

Set Block Parameters

In your Simulink® model, set these Simulation 3D UAV Vehicle block parameters :

  • Type to Custom.

  • Path to the path in the Unreal Engine project that contains the imported mesh.

See Also

|

Related Topics

External Websites