util.GetModelMeshes
table, table util.GetModelMeshes( string model, number lod = 0, string or number bodygroupMask = 0, number skin = 0 )
Description
Retrieves vertex, triangle, and bone data for the visual meshes of a given model.
This does not work on brush models (Models with names in the format
*number
)Arguments
2 number lod = 0
Which of the model's Level of Detail (LOD) models to retrieve.
0
is the best quality with higher numbers progressively lowering the quality.
3 string or number bodygroupMask = 0
The combination of bodygroups to retrieve meshes for. This can also be a specially formatted bitflag.
For more information, see Entity:SetBodyGroups.
4 number skin = 0
Skin index. Affects the
.material
of ModelMeshData structure.
For more information, see Entity:GetSkin.
This was recently added in version (2025.10.16). It might only be available on the Dev Branch right now.
Returns
1 sequential table<ModelMeshData structure> modelMeshes
Each index in this table corresponds to a mesh within the model passed as an argument to this function.
The mesh data is raw, and is not transformed via bone transformations. That's what the second return value is for.
2 sequential table<BoneBindPose structure> modelBindPoses
This tables indices are bone IDs for the BoneBindPose structure stored at each index.
Example
A snippet of Entity code that renders a wireframe helicopter bomb by retrieving the model's mesh and using it to create a new mesh.