Difference between revisions of "love.physics.newRectangleBody"

(Created page)
 
(Link to Body in Returns)
 
(One intermediate revision by the same user not shown)
Line 7: Line 7:
 
=== Synopsis ===
 
=== Synopsis ===
 
<source lang="lua">
 
<source lang="lua">
body = love.physics.newRectangleBody( type, x, y, width, height, angle )
+
body = love.physics.newRectangleBody( world, type, x, y, width, height, angle )
 
</source>
 
</source>
 
=== Arguments ===
 
=== Arguments ===
 +
{{param|World|world|The world to create the body in.}}
 
{{param|BodyType|type|The type of the body.}}
 
{{param|BodyType|type|The type of the body.}}
 
{{param|number|x|The x position of the body in the world.}}
 
{{param|number|x|The x position of the body in the world.}}
Line 17: Line 18:
 
{{param|number|angle (0)|The initial local angle of the rectangle relative to the body.}}
 
{{param|number|angle (0)|The initial local angle of the rectangle relative to the body.}}
 
=== Returns ===
 
=== Returns ===
{{param|Body|body|The new Body with an attached rectangle [[PolygonShape]]. The shape's center is at the local origin of the body.}}
+
{{param|Body|body|The new [[Body]] with an attached rectangle [[PolygonShape]]. The shape's center is at the local origin of the body.}}
  
 
== See Also ==
 
== See Also ==

Latest revision as of 21:27, 3 August 2024

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( world, type, x, y, width, height, angle )

Arguments

World world
The world to create the body in.
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