World:newCollider

Edit

Adds a new Collider to the World, without attaching any Shapes to it. Use Collider:addShape to add shapes.



Arguments

NameTypeDescription
xnumber The x position of the Collider.
ynumber The y position of the Collider.
znumber The z position of the Collider.

Returns

NameTypeDescription
colliderCollider The new Collider.

Arguments

NameTypeDescription
positionVec3 The position of the Collider.

Returns

NameTypeDescription
colliderCollider The new Collider.

Notes

This will throw an error if there are too many colliders in the world. The limit defaults to 16384 and can be changed in lovr.physics.newWorld.

Example

function lovr.load()
  world = lovr.physics.newWorld()
  collider = world:newCollider(0, 0, 0)
  shape = lovr.physics.newSphereShape(.5)
  collider:addShape(shape)
end

See also