- Documentation
- Client functions
- engineLoadMesh
Function
engineLoadMesh
Loads a 3D model from a resource file: .obj, .stl, .ply, .gltf, .glb, .fbx, .3ds and .dff from GTA SA (textures from a .txd next to it). Place the model with createMeshObject or put it under a number with engineReplaceModel.
Syntax
mesh engineLoadMesh(string filePath [, string format])Arguments
filePathstring- The model file.
formatstring, optional- The format when the extension does not tell it.
Returns
The model or false.
Example
local mesh = engineLoadMesh("modele/pomnik.glb")
if mesh then createMeshObject(mesh, 2495, -1680, 13.5) end
<meta>
<script src="client.lua" type="client" />
<file src="modele/pomnik.glb" />
</meta>
Notes
Straight from Blender. Models straight from Blender and other programs (glTF, FBX, OBJ), without converting to DFF.
See also
createMeshObjectPlaces a model fromengineLoadMeshin the world, only for this player: position, rotation and scale. Control the object with thesetMeshObject*functions.engineReplaceModelReplaces the look of a model number: with an engine asset (engineLoadAsset) or a model from a file (engineLoadMesh). Objects, vehicles and peds (skins 0-312; a file model without a skeleton is static) with that number show the new model. An object without its own collision gets one from the.dffor from the model triangles;engineReplaceCOLgives a custom collision. It works for this player, so call it in a client script. Replacing a newengineRequestModelmodel that the game has not created yet (the player is just joining, a resource restart) waits for it; a model number that does not exist givesfalse.engineFreeMeshFrees a model fromengineLoadMesh; objects placed from it disappear.getMeshInfoReturns data about a model fromengineLoadMesh: the format, the number of vertices and triangles and the bounds{ minX, minY, minZ, maxX, maxY, maxZ }in metres.