lovr.headset.newModel

Returns a new Model for the specified device.

model, options = lovr.headset.newModel(device)

Arguments

NameTypeDefaultDescription
deviceDeviceheadThe device to load a model for.

Returns

NameTypeDescription
modelModelThe new Model, or nil if a model could not be loaded.
optionstableOptions for loading the model.
.animatedbooleanWhether an animatable model should be loaded, for use with lovr.headset.animate.

Notes

This is only supported on the openvr and vrapi drivers right now.

Example

local models = {}

function lovr.draw()
  for i, hand in ipairs(lovr.headset.getHands()) do
    models[hand] = models[hand] or lovr.headset.newModel(hand)

    if models[hand] then
      local x, y, z, angle, ax, ay, az = lovr.headset.getPose(hand)
      models[hand]:draw(x, y, z, 1, angle, ax, ay, az)
    end
  end
end

See also