Updated 4 wheeled vehicle import tutorial. Merged the vehicle modeling tutorial into it. Index page updated to reflect changes in the docs structure
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 115 KiB |
After Width: | Height: | Size: 140 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 104 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 8.7 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 6.0 KiB |
|
@ -70,7 +70,11 @@ CARLA forum</a>
|
||||||
[__Add friction triggers__](tuto_G_add_friction_triggers.md) — Define dynamic box triggers for wheels.
|
[__Add friction triggers__](tuto_G_add_friction_triggers.md) — Define dynamic box triggers for wheels.
|
||||||
[__Control vehicle physics__](tuto_G_control_vehicle_physics.md) — Set runtime changes on a vehicle physics.
|
[__Control vehicle physics__](tuto_G_control_vehicle_physics.md) — Set runtime changes on a vehicle physics.
|
||||||
[__Control walker skeletons__](tuto_G_control_walker_skeletons.md) — Animate walkers using skeletons.
|
[__Control walker skeletons__](tuto_G_control_walker_skeletons.md) — Animate walkers using skeletons.
|
||||||
|
[__Generate maps with OpenStreetMap__](tuto_G_openstreetmap.md) — Use OpenStreetMap to generate maps for use in simulations.
|
||||||
[__Retrieve simulation data__](tuto_G_retrieve_data.md) — A step by step guide to properly gather data using the recorder.
|
[__Retrieve simulation data__](tuto_G_retrieve_data.md) — A step by step guide to properly gather data using the recorder.
|
||||||
|
[__CarSim Integration (Beta)__](tuto_G_carsim_integration.md) — Tutorial on how to run a simulation using the CarSim vehicle dynamics engine.
|
||||||
|
[__RLlib Integration__](tuto_G_rllib_integration.md) — Find out how to run your own experiment using the RLlib library.
|
||||||
|
[__Scenic__](tuto_G_scenic.md) — Follow an example of defining different scenarios using the Scenic library.
|
||||||
|
|
||||||
## Tutorials — Assets
|
## Tutorials — Assets
|
||||||
[__Add a new map__](tuto_A_add_map_overview.md) — Create and ingest a new map.
|
[__Add a new map__](tuto_A_add_map_overview.md) — Create and ingest a new map.
|
||||||
|
@ -79,14 +83,14 @@ CARLA forum</a>
|
||||||
[__Create standalone packages__](tuto_A_create_standalone.md) — Generate and handle standalone packages for assets.
|
[__Create standalone packages__](tuto_A_create_standalone.md) — Generate and handle standalone packages for assets.
|
||||||
[__Map customization__](tuto_A_map_customization.md) — Edit an existing map.
|
[__Map customization__](tuto_A_map_customization.md) — Edit an existing map.
|
||||||
[__Material customization__](tuto_A_material_customization.md) — Edit vehicle and building materials.
|
[__Material customization__](tuto_A_material_customization.md) — Edit vehicle and building materials.
|
||||||
[__Vehicle modelling__](tuto_A_vehicle_modelling.md) — Create a new vehicle for CARLA.
|
|
||||||
|
|
||||||
## Tutorials — Developers
|
## Tutorials — Developers
|
||||||
[__Contribute with new assets__](tuto_D_contribute_assets.md) — Add new content to CARLA.
|
[__Contribute with new assets__](tuto_D_contribute_assets.md) — Add new content to CARLA.
|
||||||
[__Create a sensor__](tuto_D_create_sensor.md) — Develop a new sensor to be used in CARLA.
|
[__Create a sensor__](tuto_D_create_sensor.md) — Develop a new sensor to be used in CARLA.
|
||||||
|
[__Create semantic tags__](tuto_D_create_semantic_tags.md) — Define customized tags for semantic segmentation.
|
||||||
[__Customize vehicle suspension__](tuto_D_customize_vehicle_suspension.md) — Modify the suspension system of a vehicle.
|
[__Customize vehicle suspension__](tuto_D_customize_vehicle_suspension.md) — Modify the suspension system of a vehicle.
|
||||||
[__Make a release__](tuto_D_make_release.md) — For developers who want to publish a release.
|
|
||||||
[__Generate detailed colliders__](tuto_D_generate_colliders.md) — Create detailed colliders for vehicles.
|
[__Generate detailed colliders__](tuto_D_generate_colliders.md) — Create detailed colliders for vehicles.
|
||||||
|
[__Make a release__](tuto_D_make_release.md) — For developers who want to publish a release.
|
||||||
[__Generate pedestrian navigation__](tuto_D_generate_pedestrian_navigation.md) — Obtain the information needed for walkers to move around.
|
[__Generate pedestrian navigation__](tuto_D_generate_pedestrian_navigation.md) — Obtain the information needed for walkers to move around.
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
|
@ -1,119 +1,237 @@
|
||||||
# Add a new vehicle
|
# Add a new vehicle
|
||||||
|
|
||||||
This tutorial covers step by step the process to add a new vehicle model. From the very moment the model is finished, to a simple test in CARLA.
|
This tutorial details how to add a new vehicle to CARLA. There are two sections, one for 4 wheeled vehicles and one for 2 wheeled vehicles. There is an outline of the basic requirements that must be fulfilled when modeling your vehicle to ensure that it works well in CARLA and instructions on configurations required after the vehicle has been imported into Unreal Engine.
|
||||||
|
|
||||||
* [__Add a 4 wheeled vehicle__](#add-a-4-wheeled-vehicle)
|
* [__Add a 4 wheeled vehicle__](#add-a-4-wheeled-vehicle)
|
||||||
* [Bind the skeleton](#bind-the-skeleton)
|
* [Bind and model the vehicle](#bind-and-model-the-vehicle)
|
||||||
* [Import and prepare the vehicle](#import-and-prepare-the-vehicle)
|
* [Import and configure the vehicle](#import-and-configure-the-vehicle)
|
||||||
* [__Add a 2 wheeled vehicle__](#add-a-2-wheeled-vehicle)
|
* [__Add a 2 wheeled vehicle__](#add-a-2-wheeled-vehicle)
|
||||||
|
|
||||||
!!! Important
|
!!! Important
|
||||||
This tutorial only applies to users that work with a build from source, and have access to the Unreal Editor.
|
This tutorial only applies to users that work with a build from source, and have access to the Unreal Engine Editor.
|
||||||
|
|
||||||
---
|
---
|
||||||
## Add a 4 wheeled vehicle
|
## Add a 4 wheeled vehicle
|
||||||
|
|
||||||
### Bind the skeleton
|
Vehicles added to CARLA need to use a __common base skeleton__ which is found [__here__](https://carla-assets.s3.eu-west-3.amazonaws.com/fbx/VehicleSkeleton.rar). This link will download a folder called `VehicleSkeleton.rar` which contains the base skeleton in two different `.fbx` formats, one in ASCII and the other in binary. The format you use will depend on your 3D modeling software requirements.
|
||||||
|
|
||||||
CARLA provides a general skeleton for 4-wheeled vehicles that must be used by all of them. The position of the bones can be changed, but rotating them, adding new ones or changing the hierarchy will lead to errors.
|
__The positions of the skeleton bones can be changed but any other manipulation such as rotation, addition of new bones, or changing the current hierarchy will lead to errors. __
|
||||||
|
|
||||||
__1. Download the skeleton__ from the CARLA repositories. [Here](https://carla-assets.s3.eu-west-3.amazonaws.com/fbx/VehicleSkeleton.rar) is the link to `General4WheeledVehicleSkeleton`, the reference skeleton for 4 wheeled vehicles.
|
---
|
||||||
|
|
||||||
__2. Import the skeleton__ into the 3D project of the new vehicle. This could be in Maya, Blender or whichever software used for modelling.
|
### Bind and model the vehicle
|
||||||
|
|
||||||
__3. Bind the bones__ to the corresponding portions of the mesh. Make sure to center the wheels' bones within the mesh.
|
This section details the minimum requirements in the modeling stage of your vehicle to make sure it can be used successfully in CARLA. The process involves binding the skeleton correctly to the base and wheels of the vehicle, creating Physical Asset and Collision meshes, and exporting to the correct format.
|
||||||
|
|
||||||
* __Front left wheel__ — `Wheel_Front_Left`.
|
__1. Import the base skeleton.__
|
||||||
* __Front right wheel__ — `Wheel_Front_Right`.
|
|
||||||
* __Rear left wheel__ — `Wheel_Rear_Left`.
|
Import the base skeleton into your preferred 3D modeling software. Common editors include Maya and Blender.
|
||||||
* __Rear right wheel__ — `Wheel_Rear_Right`.
|
|
||||||
* __Rest of the mesh__ — `VehicleBase`.
|
__2. Bind the bones.__
|
||||||
|
|
||||||
|
Bind the bones to the corresponding portions of the vehicle mesh according to the nomenclature below. Make sure to center the wheels' bones within the mesh.
|
||||||
|
|
||||||
|
* __Front left wheel:__ `Wheel_Front_Left`
|
||||||
|
* __Front right wheel:__ `Wheel_Front_Right`
|
||||||
|
* __Rear left wheel:__ `Wheel_Rear_Left`
|
||||||
|
* __Rear right wheel:__ `Wheel_Rear_Right`
|
||||||
|
* __Rest of the mesh:__ `VehicleBase`
|
||||||
|
|
||||||
!!! Warning
|
!!! Warning
|
||||||
Do not add new bones, change their names or the hierarchy.
|
Do not make any changes to the bone names or the hierarchy nor add any new bones.
|
||||||
|
|
||||||
__4. Export the result__. Select all the meshes and the base of the skeleton and export as `.fbx`.
|
__3. Model your vehicle.__
|
||||||
|
|
||||||
|
Vehicles should have between approximately 50,000 - 100,000 tris. We model the vehicles using the size and scale of actual cars.
|
||||||
|
|
||||||
|
We recommend that you divide the vehicle into the following materials:
|
||||||
|
|
||||||
|
>1. __Bodywork__: The metallic part of the vehicle. This material is changed to Unreal Engine material. Logos and details can be added but, to be visible, they must be painted in a different color by using the alpha channels in the Unreal Engine editor.
|
||||||
|
- __Glass_Ext__: A layer of glass that allows visibility from the outside to the inside of the vehicle.
|
||||||
|
- __Glass_Int__: A layer of glass that allows visibility from the inside to the outside of the vehicle.
|
||||||
|
- __Lights__: Headlights, indicator lights, etc.
|
||||||
|
- __LightGlass_Ext__: A layer of glass that allows visibility from the outside to the inside of the light.
|
||||||
|
- __LightGlass_Int__: A layer of glass that allows visibility from the inside to the outside of the light.
|
||||||
|
- __LicensePlate__: A rectangular plane of 29x12 cm. The texture will be assigned automatically in Unreal Engine.
|
||||||
|
- __Interior__: Any other details that don't fit in the above sections can go into _Interior_.
|
||||||
|
|
||||||
|
Materials should be named using the format `M_CarPart_CarName`, e.g., `M_Bodywork_Mustang`.
|
||||||
|
|
||||||
|
Textures should be named using the format `T_CarPart_CarName`, e.g., `T_Bodywork_Mustang`. Textures should be sized as 2048x2048.
|
||||||
|
|
||||||
|
Unreal Engine automatically creates LODs but you can also create them manually in your 3D editor. Tri counts are as follows:
|
||||||
|
|
||||||
|
- __LOD 0__: 100,000 tris
|
||||||
|
- __LOD 1__: 80,000 tris
|
||||||
|
- __LOD 2__: 60,000 tris
|
||||||
|
- __LOD 3__: 30,000 tris
|
||||||
|
|
||||||
|
|
||||||
### Import and prepare the vehicle
|
__4. Create the Physical Asset mesh.__
|
||||||
|
|
||||||
* __1. Create a new folder__ named `<vehicle_name>` in `Content/Carla/Static/Vehicle`.
|
The Physical Asset mesh is an additional mesh that allows Unreal Engine to calculate the vehicle's physics. It should be as simple as possible, with a reduced number of polygons, and should cover the whole vehicle except for the wheels. See the image below for an example.
|
||||||
<br>
|
|
||||||
|
|
||||||
* __2. Import the `.fbx`__ in its folder. The Skeletal Mesh will appear along with two new files, `<vehicle_name>_PhysicsAssets` and `<vehicle_name>_Skeleton`.
|
>>![physical asset mesh](../img/physical_asset_mesh.png)
|
||||||
* __2.1 - *Import Content Type*__ — `Geometry and Skinning Weights`.
|
|
||||||
* __2.2 - *Normal Import Method*__ — `Import Normals`.
|
|
||||||
* __2.3 - *Material Import Method*__ — Optionally choose `Do not create materials` and uncheck `Import Textures` to avoid Unreal creating its own default materials.
|
|
||||||
|
|
||||||
!!! Note
|
The Physical Asset mesh should be exported as a separate `.fbx` file. The final file should fulfill the following requirements:
|
||||||
If Unreal does not create the vehicle materials, these will have to be created manually.
|
|
||||||
|
|
||||||
* __3. Open `<vehicle_name>_PhysicsAssets`__ to set the vehicle colliders.
|
- Have a base mesh. This should be a copy of the Physical Asset mesh. It should have the same name as the original vehicle.
|
||||||
* __3.1 - Change the wheels' colliders__ — Select a sphere and adjust it to the shape of the wheel.
|
- The Physical Asset mesh must be named using the format `UCX_<vehicle_name>_<number_of_mesh>`, __otherwise it will not be recognized by Unreal Engine.__
|
||||||
* __3.2 - Change the wheels' *Physics Type*__ — Select `Kinematic` for all of them.
|
- The mesh must not extend beyond the boundaries of the original model.
|
||||||
* __3.3 - Change the general collider__ — Select a box and adjust it to the shape of the vehicle.
|
- The mesh should have the same position as the original model.
|
||||||
* __3.4 - Enable *Simulation Generates Hit Event*__ — Check it for all of the physics' bodies.
|
|
||||||
|
|
||||||
![add_vehicle_step_03](img/add_vehicle_step_03.jpg)
|
>>![base mesh](../img/base_mesh.png)
|
||||||
<div style="text-align: right"><i>Step 3, set colliders.</i></div>
|
|
||||||
|
|
||||||
* __4. Create the Animation Blueprint__. In the new vehicle folder, click right and go to `Create advanced asset/Animation/Animation blueprint`.
|
Export the final mesh as an `.fbx` file with the name `SMC_<vehicle_name>.fbx`.
|
||||||
* __4.1 - *Parent Class*__ — `VehicleAnimInstance`.
|
|
||||||
* __4.2 - *Skeleton*__ — `<vehicle_name>_Skeleton`.
|
|
||||||
* __4.3 - Rename the blueprint__ — `BP_<vehicle_name>_anim`.
|
|
||||||
* __4.4 - Copy an existing Animation Blueprint__ — Go to `Content/Carla/Static/Vehicle` and choose any vehicle folder. Open its Animation Blueprint and copy the content from the *AnimGraph*.
|
|
||||||
* __4.5 - Compile the Animation Blueprint__ — Connect the content in the blueprint and click the button `Compile` on the top left corner.
|
|
||||||
|
|
||||||
![add_vehicle_step_04](img/add_vehicle_step_04.jpg)
|
__5. Create the Collision mesh.__
|
||||||
<div style="text-align: right"><i>Step 4.5, connect the blueprint.</i></div>
|
|
||||||
|
|
||||||
* __5. Create a folder for the vehicle blueprints__. Go to `Content/Carla/Blueprints/Vehicles` and create a new folder `<vehicle_name>`.
|
The Collision mesh allows Unreal Engine to identify the vehicle's shape and use that to calculate collisions. This mesh should have a slightly more defined geometry than the Physical Asset mesh.
|
||||||
<br>
|
|
||||||
* __6. Create blueprints for the wheels__. Inside the folder, right-click and go to `Created advanced assets/Blueprints class`. Create two blueprints derived from `VehicleWheel`, one named `<vehicle_name>_FrontWheel` and the other `<vehicle_name>_RearWheel`.
|
|
||||||
* __6.1 - *Shape radius*__ — Exactly the radius, not diameter, of the wheel mesh.
|
|
||||||
* __6.2 - *Tire Config*__ — `CommonTireConfig`.
|
|
||||||
* __6.3 - On the front wheel__ — Set `Steer Angle`, default is `70`. Uncheck `Affected by Handbrake`.
|
|
||||||
* __6.4 - On the rear wheel__ — Set `Steer Angle` to `0`. Check `Affected by Handbrake`.
|
|
||||||
|
|
||||||
![add_vehicle_step_06](img/add_vehicle_step_06.jpg)
|
Consider the following points when creating the Collision mesh:
|
||||||
<div style="text-align: right"><i>Step 6.3, front wheel setup.</i></div>
|
|
||||||
|
|
||||||
* __7. Create a blueprint for the vehicle__. Inside the folder, create another blueprint derived from `BaseVehiclePawn` and named `BP_<vehicle_name>`.
|
- The mesh should cover all aspects of the vehicle, including wheels, side mirrors, and grilles.
|
||||||
* __7.1 - *Mesh*__ — Choose the skeletal mesh of the vehicle.
|
- The wheels should be cylinders of no more than 16 loops.
|
||||||
* __7.2 - *Anim class*__ — Choose the Animation blueprint created in *step 4*.
|
- Various meshes can be joined together if required.
|
||||||
* __7.3 - *Vehicle bounds*__ — Adjust it to include the whole volume of the vehicle.
|
- The mesh(es) must not extend beyond the boundaries of the original model.
|
||||||
|
- The mesh(es) should have the same position as the original.
|
||||||
|
|
||||||
!!! Note
|
>>![collision mesh](../img/collision_mesh.png)
|
||||||
These options appear in the menu *Components* on the left side of the window.
|
|
||||||
|
|
||||||
![add_vehicle_step_07](img/add_vehicle_step_07.jpg)
|
Export the final mesh as an `.fbx` file with the name `SM_sc_<vehicle_name>.fbx`.
|
||||||
<div style="text-align: right"><i>Step 6.3, create the blueprint.</i></div>
|
|
||||||
|
|
||||||
* __8. Pair the wheels with their blueprint__. In `Vehicle Movement/Wheel Setups` expand the menu and prepare each wheel.
|
__5. Export the vehicle mesh(es).__
|
||||||
* __8.1 - *Wheel_Front_Left*__ — `<vehicle_model>_FrontWheel`
|
|
||||||
* __8.2 - *Wheel_Front_Right*__ — `<vehicle_model>_FrontWheel`
|
|
||||||
* __8.3 - *Wheel_Rear_Left*__ — `<vehicle_model>_RearWheel`
|
|
||||||
* __8.4 - *Wheel_Rear_Right*__ — `<vehicle_model>_RearWheel`
|
|
||||||
|
|
||||||
![add_vehicle_step_08](img/add_vehicle_step_08.jpg)
|
Select all the main vehicle mesh(es) and the skeleton base and export as `.fbx`.
|
||||||
<div style="text-align: right"><i>Step 8, pair the wheels.</i></div>
|
|
||||||
|
|
||||||
* __9 - Compile the blueprint__ — Click the button `Compile` on the top left corner.
|
---
|
||||||
<br>
|
|
||||||
* __10 - Add the vehicle__. In `Content/Carla/Blueprint/Vehicle`, open the `VehicleFactory` and add a new element to the array of vehicles.
|
|
||||||
* __10.1 - *Make*__ — Choose a name to be used in Unreal.
|
|
||||||
* __10.2 - *Model*__ — Choose the name to be used in the blueprint library in CARLA.
|
|
||||||
* __10.3 - *Class*__ — `BP_<vehicle_name>`.
|
|
||||||
* __10.4 - *Recommended colors*__ — Optionally, provide a set of recommended colors for the vehicle.
|
|
||||||
|
|
||||||
![add_vehicle_step_10](img/add_vehicle_step_10.jpg)
|
### Import and configure the vehicle
|
||||||
<div style="text-align: right"><i>Step 10, add the new vehicle.</i></div>
|
|
||||||
|
This section details the process of importing the vehicle into Unreal Engine for use in CARLA. Perform these steps in the Unreal Engine editor.
|
||||||
|
|
||||||
|
__1. Create the vehicle folder.__
|
||||||
|
|
||||||
|
Create a new folder named `<vehicle_name>` in `Content/Carla/Static/Vehicles/4Wheeled`.
|
||||||
|
|
||||||
|
__2. Import the `.fbx`.__
|
||||||
|
|
||||||
|
Inside the new vehicle folder, import your main vehicle skeleton `.fbx` by right-clicking in the **_Content Browser_** and selecting **_Import into Game/Carla/Static/Vehicles/4Wheeled/<vehicle_name\>_**.
|
||||||
|
|
||||||
|
In the dialogue box that pops up:
|
||||||
|
|
||||||
|
- Set **_Import Content Type_** to `Geometry and Skinning Weights`.
|
||||||
|
- Set **_Normal Import Method_** to `Import Normals`.
|
||||||
|
- Optionally set **_Material Import Method_** to `Do not create materials`. Uncheck **_Import Textures_** to avoid Unreal Engine creating default materials.
|
||||||
|
|
||||||
|
The Skeletal Mesh will appear along with two new files, `<vehicle_name>_PhysicsAssets` and `<vehicle_name>_Skeleton`.
|
||||||
|
|
||||||
|
__3. Set the Collision mesh.__
|
||||||
|
|
||||||
|
>1. Open `<vehicle_name>_PhysicsAssets` from the **_Content Browser_**.
|
||||||
|
- Right-click on the `Vehicle_Base` mesh in the **_Skeleton Tree_** panel and go to **_Copy Collision from StaticMesh_**.
|
||||||
|
- Search for and select your `SM_sc_<vehicle_name>` file. You should see the outline of the Collision mesh appear in the viewport.
|
||||||
|
- Delete the default capsule shape from the `Vehicle_Base`.
|
||||||
|
- Select all the wheels:
|
||||||
|
- Go to the **_Tools_** panel and change the **_Primitive Type_** to `Sphere`.
|
||||||
|
- Go to the **_Details_** panel and change **_Physics Type_** to `Kinematic`.
|
||||||
|
- Click **_Re-generate Bodies_**.
|
||||||
|
- Adjust the wheel sphere to the size of the wheel.
|
||||||
|
- Save and close the window.
|
||||||
|
|
||||||
|
>>![Collision mesh](../img/collision_mesh_vehicle.png)
|
||||||
|
|
||||||
|
__4. Create the Animation Blueprint.__
|
||||||
|
|
||||||
|
>1. In the **_Content Browser_**, right-click inside your vehicle folder and select **_Animation -> Animation Blueprint_**.
|
||||||
|
- In **_Parent Class_** search for and select `VehicleAnimInstance`.
|
||||||
|
- In **_Target Skeleton_** search for and select `<vehicle_name>_Skeleton`.
|
||||||
|
- Press **_OK_** and rename the blueprint as `AnimBP_<vehicle_name>`.
|
||||||
|
|
||||||
|
__5. Configure the Animation Blueprint.__
|
||||||
|
|
||||||
|
To ease the process of configuring the animation blueprint, we will copy an existing one from a native CARLA vehicle:
|
||||||
|
|
||||||
|
>1. Go to `Content/Carla/Static/Vehicle` and choose any CARLA vehicle folder. Open its Animation Blueprint.
|
||||||
|
- In the **_My Blueprint_** panel, double click on **_AnimGraph_**. You will see the graph come up in the viewport.
|
||||||
|
- Click and drag to select the **_Mesh Space Ref Pose_**, **_Wheel Handler_**, and **_Component To Local_** components. Right-click and select **_Copy_**.
|
||||||
|
- Go back to your own vehicle Animation Blueprint and paste the copied contents into the graph area.
|
||||||
|
- Click and drag from the standing figure in the **_Component To Local_** component to the figure in **_Output Pose_** to join the components together.
|
||||||
|
- Click **_Compile_** in the top left corner. You should now see a pulsating line flowing through the entire sequence.
|
||||||
|
- Save and close the window.
|
||||||
|
|
||||||
|
>>![add_vehicle_step_04](img/add_vehicle_step_04.jpg)
|
||||||
|
|
||||||
|
__6. Prepare the vehicle and wheel blueprints.__
|
||||||
|
|
||||||
|
>1. In the **_Content Browser_**, go to `Content/Carla/Blueprints/Vehicles` and create a new folder `<vehicle_name>`.
|
||||||
|
- Inside the folder, right-click and go to **_Blueprint Class_**. Open the **_All Classes_** section in the pop-up.
|
||||||
|
- Search for `BaseVehiclePawn` and press **_Select_**.
|
||||||
|
- Rename the file as `BP_<vehicle_name>`.
|
||||||
|
- Go to the folder of any of the native CARLA vehicles in `Carla/Blueprints/Vehicles`. From the **_Content Browser_**, copy the four wheel blueprints into the blueprint folder for your own vehicle. Rename the files to replace the old vehicle name with your own vehicle name.
|
||||||
|
|
||||||
|
>>![Copy wheel blueprints](../img/copy_wheel_blueprint.png)
|
||||||
|
|
||||||
|
__7. Configure the wheel blueprints.__
|
||||||
|
|
||||||
|
>1. In your vehicle blueprint folder, open all four of the wheel blueprints.
|
||||||
|
- In the **_Class Defaults_** panel, set **_Collision Mesh_** to `Wheel_Shape`.
|
||||||
|
- Adjust the values for wheel shape radius, width, mass, and damping rate according to your vehicle specifications.
|
||||||
|
- Set **_Tire Config_** to `CommonTireConfig`
|
||||||
|
- On the front wheels set **_Steer Angle_** according to your preferences (default is `70`). Uncheck **_Affected by Handbrake_**.
|
||||||
|
- On the rear wheels set **_Steer Angle_** to `0`. Check **_Affected by Handbrake_**.
|
||||||
|
- When setting the suspension values, you can use the values [here](tuto_D_customize_vehicle_suspension.md) as a guide.
|
||||||
|
- Compile and save.
|
||||||
|
|
||||||
|
>>![wheel shape](../img/wheel_shape.png)
|
||||||
|
|
||||||
|
__8. Configure vehicle blueprint.__
|
||||||
|
|
||||||
|
>1. From the **_Content Browser_**, open your `BP_<vehicle_name>`.
|
||||||
|
- In the **_Components_** panel, select **_Mesh (VehicleMesh) (Inherited)_**.
|
||||||
|
- In the **_Details_** panel, go to **_Skeletal Mesh_** and search for and select the base skeleton file of your vehicle (located in the `Carla/Static/Vehicles/4Wheeled/<vehicle_name>` folder).
|
||||||
|
- Go to **_Anim Class_** in the **_Details_** panel. Search for and select your `AnimBP_<vehicle_name>` file.
|
||||||
|
- In the **_Components_** panel, select **_Custom Collision (Inherited)_**.
|
||||||
|
- Select **_Static Mesh_** in the **_Details_** panel and search for your `SM_sc_<vehicle_name>` collision mesh.
|
||||||
|
- In the **_Components_** panel, select **_VehicleMovement (MovementComp) (Inherited)_**.
|
||||||
|
- In the **_Details_** panel, search for `wheel`. You will find settings for each of the wheels. For each one, click on **_Wheel Class_** and search for the `BP_<vehicle_name>_<wheel_name>` file that corresponds to the correct wheel position.
|
||||||
|
|
||||||
|
>>>>![wheel blueprint](../img/wheel_blueprint.png)
|
||||||
|
|
||||||
|
If you have any additional meshes for your vehicle (doors, lights, etc.,) separate from the base mesh:
|
||||||
|
|
||||||
|
>1. Drag them into the **_Mesh (VehicleMesh) (Inherited)_** hierarchy in the **_Components_** panel.
|
||||||
|
- Select the extra meshes in the hierarchy and search for `Collision` in the **_Details_** panel.
|
||||||
|
- Set **_Collision Presets_** to `NoCollision`.
|
||||||
|
- Select any lights meshes in the hierarchy. Search for `Tag` in the **_Details_** panel and add the tag `emissive`.
|
||||||
|
|
||||||
|
Click **_Save_** and **_Compile_**.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
__9. Add the vehicle to the Blueprint Library__.
|
||||||
|
|
||||||
|
>1. In `Content/Carla/Blueprint/Vehicle`, open the `VehicleFactory` file.
|
||||||
|
- In the **_Generate Definitions_** tab, double click **_Vehicles_**.
|
||||||
|
- In the **_Details_** panel, expand the **_Default Value_** section and add a new element to the vehicles array.
|
||||||
|
- Fill in the **_Make_** and **_Model_** of your vehicle.
|
||||||
|
- Fill in the **_Class_** value with your `BP_<vehicle_name>` file.
|
||||||
|
- Optionally, provide a set of recommended colors for the vehicle.
|
||||||
|
- Compile and save.
|
||||||
|
|
||||||
|
>![vehicle factory](../img/vehicle_factory.png)
|
||||||
|
|
||||||
|
__10. Test the vehicle__.
|
||||||
|
|
||||||
|
Launch CARLA, open a terminal in `PythonAPI/examples` and run the following command:
|
||||||
|
|
||||||
* __11. Test the vehicle__. Launch CARLA, open a terminal in `PythonAPI/examples` and run the following command.
|
|
||||||
```sh
|
```sh
|
||||||
python3 manual_control.py --filter <model_name> # The name used in step 10.2
|
python3 manual_control.py --filter <model_name> # The make or model defined in step 9
|
||||||
```
|
```
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
Even if you used upper case characters in your make and model, they need to be converted to lower case when passed to the filter.
|
||||||
|
|
||||||
---
|
---
|
||||||
## Add a 2 wheeled vehicle
|
## Add a 2 wheeled vehicle
|
||||||
|
|
||||||
|
|
|
@ -1,116 +0,0 @@
|
||||||
# How to model vehicles
|
|
||||||
|
|
||||||
* [__4-wheeled Vehicles__](#4-wheeled-vehicles)
|
|
||||||
* [Modelling](#modelling)
|
|
||||||
* [Naming materials](#naming-materials)
|
|
||||||
* [Texturing](#texturing)
|
|
||||||
* [Rigging](#rigging)
|
|
||||||
* [LODs](#lods)
|
|
||||||
|
|
||||||
---
|
|
||||||
## 4-Wheeled Vehicles
|
|
||||||
|
|
||||||
### Modelling
|
|
||||||
|
|
||||||
Vehicles must have a minimum of 10.000 and a maximum of 17.000 Tris
|
|
||||||
approximately. We model the vehicles using the size and scale of actual cars.
|
|
||||||
The bottom part of the vehicle consists of a plane adjusted to the Bodywork.
|
|
||||||
|
|
||||||
The vehicle must be divided in 6 materials:
|
|
||||||
|
|
||||||
1. **BodyWork:**
|
|
||||||
The Bodywork includes the chassis, doors, car handle, and front and back
|
|
||||||
parts of the vehicle. The BodyWork material is controlled by Unreal Engine.
|
|
||||||
You can add logos and some details, but remember, all the details will be
|
|
||||||
painted by Unreal using the same color. Use the alpha channel if you want to
|
|
||||||
paint details with a different color.
|
|
||||||
|
|
||||||
2. **Wheels:**
|
|
||||||
Model the Wheels with hubcaps and add details to the tire with Substance. In
|
|
||||||
the UV, add the tires and the hubcaps separately.
|
|
||||||
|
|
||||||
3. **Interior:**
|
|
||||||
The Interior includes the seats, the steering wheel, and the bottom of the
|
|
||||||
vehicle. You don’t need to add much detail here.
|
|
||||||
|
|
||||||
4. **Details:**
|
|
||||||
Lights, logos, exhaust pipes, protections, and grille.
|
|
||||||
|
|
||||||
5. **Glass:**
|
|
||||||
Light glasses, windows, etc. This material is controlled by Unreal.
|
|
||||||
|
|
||||||
6. **LicencePlate:**
|
|
||||||
Put a rectangular plane with this size 29-12 cm, for the licence Plate.
|
|
||||||
We assign the license plate texture.
|
|
||||||
|
|
||||||
### Naming materials
|
|
||||||
|
|
||||||
* M(Material)_"CarName"_Bodywork(part of car)
|
|
||||||
|
|
||||||
* M_"CarName"_Wheel
|
|
||||||
|
|
||||||
* M_"CarName"_Interior
|
|
||||||
|
|
||||||
* M_"CarName"_Details
|
|
||||||
|
|
||||||
* M_"CarName"_Glass
|
|
||||||
|
|
||||||
* M_"CarName"_LicencePlate
|
|
||||||
|
|
||||||
### Texturing
|
|
||||||
|
|
||||||
The size of the textures is 2048x2048.
|
|
||||||
|
|
||||||
* T_"CarName"_PartOfMaterial_d (BaseColor)
|
|
||||||
|
|
||||||
* T_"CarName"_PartOfMaterial_n (Normal)
|
|
||||||
|
|
||||||
* T_"CarName"_PartOfMaterial_orm (OcclusionRoughnessMetallic)
|
|
||||||
|
|
||||||
* **EXAMPLE**:
|
|
||||||
Type of car Tesla Model 3
|
|
||||||
|
|
||||||
TEXTURES
|
|
||||||
* T_Tesla3_BodyWork_d
|
|
||||||
* T_Tesla3_BodyWork_n
|
|
||||||
* T_Tesla3_BodyWork_orm
|
|
||||||
|
|
||||||
MATERIAL
|
|
||||||
* M_Tesla3_BodyWork
|
|
||||||
|
|
||||||
### Rigging
|
|
||||||
|
|
||||||
The easiest way is to copy the "General4WheeledVehicleSkeleton" present in our project,
|
|
||||||
either by exporting it and copying it to your model or by creating your skeleton
|
|
||||||
using the same bone names and orientation.
|
|
||||||
|
|
||||||
The model and every bone must be oriented towards positive X axis with the Z
|
|
||||||
axis facing upwards.
|
|
||||||
|
|
||||||
_Bone Setup:_
|
|
||||||
|
|
||||||
Vhehicle_Base: The origin point of the mesh, place it in the point (0,0,0) of the scene.
|
|
||||||
|
|
||||||
* Wheel_Front_Left: Set the joint's position in the middle of the Wheel.
|
|
||||||
|
|
||||||
* Wheel_Front_Right: Set the joint's position in the middle of the Wheel.
|
|
||||||
|
|
||||||
* Wheel_Rear_Left: Set the joint's position in the middle of the Wheel.
|
|
||||||
|
|
||||||
* Wheel_Rear_Left: Set the joint's position in the middle of the Wheel.
|
|
||||||
|
|
||||||
#### LODs
|
|
||||||
|
|
||||||
All vehicle LODs must be made in Maya or other 3D software. Because Unreal does
|
|
||||||
not generate LODs automatically, you can adjust the number of Tris to make a
|
|
||||||
smooth transitions between levels.
|
|
||||||
|
|
||||||
* _Level 0_ - Original
|
|
||||||
|
|
||||||
* _Level 1_ - Deleted 2.000/2.500 Tris (_Do not delete the interior and steering wheel_)
|
|
||||||
|
|
||||||
* _Level 2_ - Deleted 2.000/2.500 Tris (_Do not delete the interior_)
|
|
||||||
|
|
||||||
* _Level 3_ - Deleted 2.000/2.500 Tris (_Delete the interior_)
|
|
||||||
|
|
||||||
* _Level 4_ - Simple shape of a vehicle.
|
|
|
@ -61,7 +61,6 @@ nav:
|
||||||
- 'Create standalone packages': 'tuto_A_create_standalone.md'
|
- 'Create standalone packages': 'tuto_A_create_standalone.md'
|
||||||
- 'Map customization tools': 'tuto_A_map_customization.md'
|
- 'Map customization tools': 'tuto_A_map_customization.md'
|
||||||
- "Material customization": 'tuto_A_material_customization.md'
|
- "Material customization": 'tuto_A_material_customization.md'
|
||||||
- 'Vehicle modelling': 'tuto_A_vehicle_modelling.md'
|
|
||||||
- Tutorials (developers):
|
- Tutorials (developers):
|
||||||
- 'Contribute assets': 'tuto_D_contribute_assets.md'
|
- 'Contribute assets': 'tuto_D_contribute_assets.md'
|
||||||
- 'Create a sensor': 'tuto_D_create_sensor.md'
|
- 'Create a sensor': 'tuto_D_create_sensor.md'
|
||||||
|
|