love.physics.newBody

Creates a new body.

There are three types of bodies.

The mass of the body gets calculated when a Fixture is attached or removed, but can be changed at any time with Body:setMass or Body:resetMassData.

O.png Making changes to a World is not allowed inside of the beginContact, endContact, preSolve, and postSolve callback functions, as BOX2D locks the world during these callbacks.  

Function

Available since LÖVE 0.8.0
This variant is not supported in earlier versions.

Synopsis

body = love.physics.newBody( world, x, y, type )

Arguments

World world
The world to create the body in.
number x (0)
The x position of the body.
number y (0)
The y position of the body.
BodyType type ("static")
The type of the body.

Returns

Body body
A new body.

Function

Removed in LÖVE 0.8.0
This variant is not supported in that and later versions.

Synopsis

body = love.physics.newBody( world, x, y, m, i )

Arguments

World world
The world to create the body in.
number x (0)
The x position of the body.
number y (0)
The y position of the body.
number m (0)
The mass of the body.
number i (0)
The rotational inertia of the body.

Returns

Body body
A new body.

See Also