Controller:newModel

Returns a new Model for the Controller.

model = Controller:newModel()

Arguments

None

Returns

NameTypeDescription
modelModelThe new Model, or nil if a model could not be loaded.

Notes

The Model will have a Texture applied.

Example

local models = {}

function lovr.draw()
  for _, controller in ipairs(lovr.headset.getControllers()) do
    local x, y, z = controller:getPosition()
    local angle, ax, ay, az = controller:getOrientation()
    models[controller] = models[controller] or controller:newModel()
    models[controller]:draw(x, y, z, 1, angle, ax, ay, az)
  end
end

See also