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 Vehicle Dynamics Blockset™ Interface for Unreal Engine® 4 Projects support package. You can specify the mesh in the Simulation 3D Vehicle or Simulation 3D Vehicle with Ground Following block to visualize the vehicle in the Unreal® Editor when you run a simulation.
Before you start, install the Vehicle Dynamics Blockset Interface for Unreal Engine 4 Projects support package. See Customize 3D Scenes for Vehicle Dynamics Simulations.
To create a compatible custom vehicle mesh, follow these workflow steps.
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 .
|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 or Simulation 3D Vehicle with Ground Following block parameters.
To create the mesh, this example uses the 3D creation software Blender® Version 2.80.
Step 1: Setup Bone Hierarchy
Import a vehicle mesh into a 3D modeling tool, for example Blender.
To ensure that this mesh is compatible with the animation components in the Vehicle Dynamics Blockset Interface for Unreal Engine 4 Projects support package, use this naming convention for the vehicle parts in the mesh.
Vehicle Part Name
Front left wheel
Front right wheel
Rear left wheel
Rear right wheel
Left indicator light
Right indicator light
Front left brake caliper
Front right brake caliper
Rear left brake caliper
Rear right brake caliper
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.
Create and assign material slots to the vehicle chassis. Confirm that the first vehicle slot corresponds to the vehicle body. For example, this image shows the hierarchy in Blender.
Create and assign material slots to the wheels.
Step 3: Export Mesh and Armature
Export the mesh and armature in the .
fbx file format. For example,
On the Object Types pane, select Armature and Mesh.
On the Transform pane, set:
Scale to 1.00
Apply Scalings to
Select Apply Unit.
On the Geometry pane:
Set Smoothing to
Select Apply Modifiers
On the Armature pane, set:
Primary Bone Axis to
Secondary Bone Axis to
Select Export FBX.
Step 4: Import Mesh to Unreal Editor
Open the Unreal Engine
AutoVrtlEnv.uprojectproject in the Unreal Editor.
In the editor, import the FBX® file as a skeletal mesh. Assign the Skeleton to the
Step 5: Set Block Parameters
In your Simulink® model, set these Simulation 3D Vehicle or Simulation 3D Vehicle with Ground Following block parameters:
Path to the path in the Unreal Engine project that contains the imported mesh.
- Coordinate Systems in Vehicle Dynamics Blockset
- How 3D Simulation for Vehicle Dynamics Blockset Works
- Unreal Engine Simulation Environment Requirements and Limitations