Main Content

Prepare Custom Vehicle Mesh for the Unreal Editor

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

Before you start, install the Automated Driving 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

Step 1: Setup Bone Hierarchy

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

Step 2: Assign Materials

Optionally, assign materials to the vehicle parts.

Step 3: Export Mesh and Armature

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

Step 4: Import Mesh to Unreal Editor

Import the vehicle mesh into the Unreal Editor.

Step 5: Set Block Parameters

Set up the Simulation 3D Vehicle with Ground Following block block parameters.

Note

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

Step 1: Setup Bone Hierarchy

  1. Import a vehicle mesh into a 3D modeling tool, for example Blender.

  2. Segment the vehicle mesh to control each vehicle part, including lights. To make the mesh compatible with the animation components in the Automated Driving Toolbox Interface for Unreal Engine Projects support package, use this naming convention for the vehicle parts in the mesh.

    Vehicle PartName

    Chassis

    VehicleBody

    Front left wheel

    Wheel_FL

    Front right wheel

    Wheel_FR

    Rear left wheel

    Wheel_RL

    Rear right wheel

    Wheel_RR

    Steering wheel

    Wheel_Steering

    Left headlight

    Lights_Headlight_Left

    Right headlight

    Lights_Headlight_Right

    Front left brake caliper

    BrakeCaliper_FL

    Front right brake caliper

    BrakeCaliper_FR

    Rear left brake caliper

    BrakeCaliper_RL

    Rear right brake caliper

    BrakeCaliper_RR

  3. Set the vehicle body object, VehicleBody as the parent of the wheel objects and other vehicle objects.

Step 2: Assign Materials

Optionally, assign material slots to vehicle parts. In this example, the mesh uses one material for the chassis and one for the four wheels.

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

  2. Create and assign material slots to the wheels.

To view the visual effects of vehicle lights, create material slots for lights in the 3D modeling tool. To make the material slot compatible with the animation components in the support package, use this naming convention for the material slots.

LightName

Headlight

M_Headlight

Left indicator light

M_IndicatorlightLeft

Right indicator light

M_IndicatorlightRight

Brake lights

M_Brakelight

Tail light

M_TailLight

Reverse lights

M_Reverselight

Step 3: 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.

Step 4: Import Mesh to Unreal Editor

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

  2. In the editor, click Import to import the FBX® file as a skeletal mesh. Assign the Skeleton to the SK_PassengenerVehicle_Skeleton asset.

    FBX Import Options with Mesh and Skeleton

    Note

    If you cannot select SK_PassengenerVehicle_Skeleton, click the gearbox. Make sure Show Engine Content and Show Plugin Content are both selected.

    FBX Import Options indicating show engine and show plugin content are both enabled

Step 5: Set Block Parameters

In your Simulink® model, set these Simulation 3D Vehicle with Ground Following block parameters:

  • Type to Custom.

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

See Also

|