Model

A Model is a drawable object loaded from a 3D file format. The supported 3D file formats are OBJ and glTF.

Constructors

lovr.graphics.newModelCreate a new Model.
lovr.headset.newModelGet a Model for a device.

Methods

Model:getAABBGet the Model's axis aligned bounding box.
Model:animateApply an animation to the pose of 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:drawDraw 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:getNodeCountGet the number of nodes in the Model.
Model:getNodeNameGet the name of a node in the Model.
Model:getNodePoseGet the pose of a single node.
Model:poseSet the pose of a single node, or clear the pose.

Example

local model

function lovr.load()
  model = lovr.graphics.newModel('assets/model.gltf', 'assets/texture.png')
end

function lovr.draw()
  model:draw(0, 1, -1, 1, lovr.timer.getTime())
end

See also