love.physics.newRectangleBody

Available since LÖVE 12.0
This function is not supported in earlier versions.

Creates a new Body with an attached rectangle PolygonShape.

This is a convenience constructor which effectively calls love.physics.newBody and love.physics.newRectangleShape.

Function

Synopsis

body = love.physics.newRectangleBody( type, x, y, width, height, angle )

Arguments

BodyType type
The type of the body.
number x
The x position of the body in the world.
number y
The y position of the body in the world.
number width
The width of the rectangle.
number height
The height of the rectangle.
number angle (0)
The initial local angle of the rectangle relative to the body.

Returns

Body body
The new Body with an attached rectangle PolygonShape. The shape's center is at the local origin of the body.

See Also


Other Languages