Models are 3D model assets loaded from files. Currently, OBJ, glTF, and binary STL files are supported.

A model can be drawn using Pass:draw.

The raw CPU data for a model is held in a ModelData object, which can be loaded on threads or reused for multiple Model instances.

Models have a hierarchy of nodes which can have their transforms modified. Meshes are attached to these nodes. The same mesh can be attached to multiple nodes, allowing it to be drawn multiple times while only storing a single copy of its data.

Models can have animations. Animations have keyframes which affect the transforms of nodes. Right now each model can only be drawn with a single animated pose per frame.

Models can have materials, which are collections of properties and textures that define how its surface is affected by lighting. Each mesh in the model can use a single material.

Constructors a new Model.
lovr.headset.newModelGet a Model for a device.


Model:animateAnimate the Model.
Model:getAnimationCountGet the number of animations in the Model.
Model:getAnimationDurationGet the duration of an animation in the Model.
Model:getAnimationNameGet the name of an animation in the Model.
Model:getBoundingBoxGet the bounding box of the Model.
Model:getBoundingSphereGet the bounding sphere of the Model.
Model:getCenterGet the center of the Model's bounding box.
Model:getDataGet the ModelData backing the Model.
Model:getDepthGet the depth of the Model.
Model:getDimensionsGet the dimensions of the Model.
Model:getHeightGet the height of the Model.
Model:getIndexBufferGet a Buffer containing the triangle indices in the Model.
Model:getMaterialGet a Material from the Model.
Model:getMaterialCountGet the number of materials in the Model.
Model:getMaterialNameGet the name of a material in the Model.
Model:getMetadataGet extra information from the model file.
Model:getNodeChildrenGet the children of a node.
Model:getNodeCountGet the number of nodes in the model.
Model:getNodeDrawGet the information needed to draw one mesh in the model.
Model:getNodeDrawCountGet the number of meshes attached to a node.
Model:getNodeNameGet the name of a node in the Model.
Model:getNodeOrientationGet the orientation of a node.
Model:getNodeParentGet the parent of a node.
Model:getNodePoseGet the pose of a node.
Model:getNodePositionGet the position of a node.
Model:getNodeScaleGet the scale of a node.
Model:getNodeTransformGet the transform of a node.
Model:getRootNodeGet the index of the root node.
Model:getTextureGet one of the textures in the Model.
Model:getTextureCountGet the number of textures in the Model.
Model:getTriangleCountGet the total number of triangles in the Model.
Model:getTrianglesGet all the triangles in the Model.
Model:getVertexBufferGet a Buffer containing the vertices in the Model.
Model:getVertexCountGet the total vertex count of the Model.
Model:getWidthGet the width of the Model.
Model:hasJointsCheck if the Model uses joints for skeletal animation.
Model:resetNodeTransformsReset node transforms.
Model:setNodeOrientationSet or blend the orientation of a node.
Model:setNodePoseSet or blend the pose of a node.
Model:setNodePositionSet or blend the position of a node.
Model:setNodeScaleSet or blend the scale of a node.
Model:setNodeTransformSet or blend the transform of a node.

See also