Jump to content

Models

A model is a specialized entity which handles mesh LOD and physics. The model class is an extension of the physics body class, so it can be physically interactive. It contains a list of meshes to use for different detail levels depending on distance from the camera.

Models can be loaded with the LoadModel() command. The engine will first look for a mesh of the name or file path provided. It will also load any LOD meshes that are found, indicated by adding the suffix "LOD"n to the file name, where n is the detail level. If a .phy physics file is found, it will be loaded and used for the model physics shape. For example, LoadModel("oildrum") or LoadModel("oildrum.md3") would first load the mesh "oildrum.md3" and use it for the highest-resolution detail level. If a mesh called "oildrumLOD1.md3" is found, it will be loaded and used for the second detail level. If a mesh called "oildrumLOD2.md3" is found, it will be loaded and used for the third detail level. If a collision file called "oildrum.phy" is found, it will be loaded and used for the model physics shape.

	oildrum.md3	 - highest detail mesh
	oildrumLOD1.md3 - second detail mesh
	oildrumLOD2.md3 - third detail mesh
	oildrum.phy	 - model physics shape
Models can use any number of LOD meshes. However, if the sequential chain of detail levels is broken, the engine will not load subsequent detail versions.
In version 2.3+, a model can also have a Lua script file associated with it. This adds scriptable behavior to our basic object class.

LUA
Models can have Lua scripts attached to them. See the Lua script reference for more info.

Commands

GetModelDetail
LoadModel
ModelDetail
ModelName
SetModelLODDistance
  • You cannot add records