Custom vehicle models
In the following guide we will go over steps to implement custom models for different jobs
Introduction
In the cd_dispatch3d/configs/config_ui.js
file you will find a list of jobs with their associated models.
A single entry in the list looks like this:
police: // Job name. Change this to the name of your job. This is used in the code and should be unique.
{
car:{ // Car model configuration. Do not change the name "car" as it is used in the code.
file_name: "police.glb", // File name of the vehicle/ped model inside the models/placeable folder.
scale: 2, // Scale of the model. 1 is default scale. Adjust as needed. Can use decimals (E.g. 0.01 or 0.1 and so on)
position_adjustment: { // Position adjustment for the model. Adjust as needed. Shifts the model in the X, Y and Z axis.
x: 0,
y: 0,
z: 0,
},
rotation_adjustment: { // Rotation adjustment for the model in DEGREES. Adjust as needed. Correct rotation enables heading tracking.
x: 0,
y: 0,
z: 0,
}
},
foot: {
file_name: "s_m_y_cop_01.glb",
scale: 3,
position_adjustment: {
x: 0,
y: 0,
z: 0,
},
rotation_adjustment: {
x: 0,
y: 0,
z: 0,
}
},
helicopter : {
file_name: "polmav.glb",
scale: 2,
position_adjustment: {
x: 0,
y: 0,
z: 0,
},
rotation_adjustment: {
x: 0,
y: 0,
z: 0,
}
},
boat : {
file_name: "predator.glb",
scale: 2,
position_adjustment: {
x: 0,
y: 0,
z: 0,
},
rotation_adjustment: {
x: 0,
y: 0,
z: 0,
}
},
motorcycle: {
file_name: "policeb.glb",
scale: 2,
position_adjustment: {
x: 0,
y: 0,
z: 0,
},
rotation_adjustment: {
x: 0,
y: 0,
z: 0,
}
}
},
The model files are located under cd_dispatch3d/models/placeable/
The job can have the next vehicle / transport types
car
foot
helicopter
boat
motorcycle
You can either provide your own, use already existing models, or if you omit any from the list the script will use default models.
Step 1 - Models
Getting your models
Our best recommendation is getting the models from the game itself in their low quality version. These models are already optimized for the game, will work the best, as well as respect FiveM's terms of service.
Here are some interesting links which can have explanations on extracting game models:
Codewalker - https://github.com/dexyfex/CodeWalker
Sollumz - https://github.com/Sollumz/Sollumz
Blender - https://www.blender.org/
*Alternatively you can grab models from websites like Sketchfab, however it might be difficult finding game optimized models with correct licensing.
Installing models
Prepare your model files and paste them into cd_dispatch3d/models/placeable/
The model files must be in a .glb
format, otherwise the resource won't recognize the files and will fail to load them.
Keep a note of the file names, since you will need them for the next step.
Step 2 - Configuration
Copy the list from the introduction step and paste it below one of the items in the config_ui.js
file.
Make sure you include the , symbol so the script doesn't break. If you are using a code editor such as VSCode it should alert you in case you miss this.
Let's assume our new job is going to be called 'bcso':
In the code you pasted, rename 'police' to 'bcso'
Change each of the transport mode file names to the names of models you have added to the placeable/
folder
Example
bcso: // Job name. Change this to the name of your job. This is used in the code and should be unique.
{
car:{ // Car model configuration. Do not change the name "car" as it is used in the code.
file_name: "sheriff.glb", // File name of the vehicle/ped model inside the models/placeable folder.
scale: 2, // Scale of the model. 1 is default scale. Adjust as needed. Can use decimals (E.g. 0.01 or 0.1 and so on)
position_adjustment: { // Position adjustment for the model. Adjust as needed. Shifts the model in the X, Y and Z axis.
x: 0,
y: 0,
z: 0,
},
rotation_adjustment: { // Rotation adjustment for the model in DEGREES. Adjust as needed. Correct rotation enables heading tracking.
x: 0,
y: 0,
z: 0,
}
},
foot: {
file_name: "s_m_y_sheriff_01.glb",
scale: 3,
position_adjustment: {
x: 0,
y: 0,
z: 0,
},
rotation_adjustment: {
x: 0,
y: 0,
z: 0,
}
},
helicopter : {
file_name: "polmav.glb",
scale: 2,
position_adjustment: {
x: 0,
y: 0,
z: 0,
},
rotation_adjustment: {
x: 0,
y: 0,
z: 0,
}
},
boat : {
file_name: "predator.glb",
scale: 2,
position_adjustment: {
x: 0,
y: 0,
z: 0,
},
rotation_adjustment: {
x: 0,
y: 0,
z: 0,
}
},
motorcycle: {
file_name: "policeb2.glb",
scale: 2,
position_adjustment: {
x: 0,
y: 0,
z: 0,
},
rotation_adjustment: {
x: 0,
y: 0,
z: 0,
}
}
},
Step 3 - Running
After completing the previous 2 steps, it is time to test our work!
In case your server is already running:
Type refresh
in server console, followed by ensure cd_dispatch3d
This should make sure the server loads all the necessary files.
In case your server is not started simply start the server.
To test our implementation switch your job to the one you just added, open the large UI and take a look at your character!
In case the map displays a model you don't recognize, it probably is the default model we provide.
If the script breaks completely, something definitely went wrong with the steps.
It is best to try following the steps again and repeating the implementation.
Congratulations on implementing your custom models! 🎉
Last updated
Was this helpful?