| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- return {
- tag = 'colliders',
- summary = 'Add a Collider to the World.',
- description = 'Adds a new Collider to the World.',
- arguments = {
- x = {
- type = 'number',
- default = '0',
- description = 'The x position of the Collider.'
- },
- y = {
- type = 'number',
- default = '0',
- description = 'The y position of the Collider.'
- },
- z = {
- type = 'number',
- default = '0',
- description = 'The z position of the Collider.'
- },
- position = {
- type = 'Vec3',
- description = 'The position of the Collider.'
- }
- },
- returns = {
- collider = {
- type = 'Collider',
- description = 'The new Collider.'
- }
- },
- variants = {
- {
- arguments = { 'x', 'y', 'z' },
- returns = { 'collider' }
- },
- {
- arguments = { 'position' },
- returns = { 'collider' }
- }
- },
- notes = [[
- This function creates a collider without any shapes attached to it, which means it won't collide
- with anything. To add a shape to the collider, use `Collider:addShape`, or use one of the
- following functions to create the collider:
- - `World:newBoxCollider`
- - `World:newCapsuleCollider`
- - `World:newCylinderCollider`
- - `World:newSphereCollider`
- ]],
- example = {
- description = [[
- Create a new world, add a collider to it, and update it, printing out the collider's position
- as it falls.
- ]],
- code = [[
- function lovr.load()
- world = lovr.physics.newWorld()
- box = world:newBoxCollider()
- end
- function lovr.update(dt)
- world:update(dt)
- print(box:getPosition())
- end
- ]]
- },
- related = {
- 'World:newBoxCollider',
- 'World:newCapsuleCollider',
- 'World:newCylinderCollider',
- 'World:newMeshCollider',
- 'World:newSphereCollider',
- 'World:newTerrainCollider',
- 'Collider',
- 'Shape'
- }
- }
|