Difference between revisions of "Shape"

m
(Undo revision 25919 by Popolon (talk))
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Shapes are solid 2d geometrical objects used in [[love.physics]].
+
[[Shape|Shapes]] are solid 2d geometrical objects which handle the mass and collision of a [[Body]] in [[love.physics]].
 +
 
 +
[[Shape|Shapes]] are attached to a [[Body]] via a [[Fixture]]. The [[Shape]] object is copied when this happens.
 +
 
 +
The [[Shape]]'s position is relative to the position of the [[Body]] it has been attached to.
  
Shapes are attached to a [[Body]] via a [[Fixture]]. The Shape object is copied when this happens. Shape position is relative to Body position.
 
 
== Constructors ==
 
== Constructors ==
 
{{#ask: [[Category:Functions]] [[Constructs::Shape]] [[Concept:Current]]
 
{{#ask: [[Category:Functions]] [[Constructs::Shape]] [[Concept:Current]]
Line 52: Line 55:
 
* [[parent::love.physics]]
 
* [[parent::love.physics]]
 
[[Category:Types]]
 
[[Category:Types]]
{{#set:Description=Shapes are objects used to control mass and collisions.}}
+
{{#set:Description=[[Shape|Shapes]] are objects used to control mass and collisions.}}
 
{{#set:Since=000}}
 
{{#set:Since=000}}
 
== Other Languages ==
 
== Other Languages ==
 
{{i18n|Shape}}
 
{{i18n|Shape}}

Latest revision as of 20:27, 4 January 2021

Shapes are solid 2d geometrical objects which handle the mass and collision of a Body in love.physics.

Shapes are attached to a Body via a Fixture. The Shape object is copied when this happens.

The Shape's position is relative to the position of the Body it has been attached to.

Constructors

love.physics.newChainShape Creates a new ChainShape. Added since 0.8.0
love.physics.newCircleShape Creates a new CircleShape.
love.physics.newEdgeShape Creates a new EdgeShape. Added since 0.8.0
love.physics.newPolygonShape Creates a new PolygonShape.
love.physics.newRectangleShape Shorthand for creating rectangular PolygonShapes.

Functions

Object:release Immediately destroys the object's Lua reference. Added since 11.0
Object:type Gets the type of the object as a string.
Object:typeOf Checks whether an object is of a certain type.
Shape:computeAABB Returns the points of the bounding box for the transformed shape. Added since 0.8.0
Shape:computeMass Computes the mass properties for the shape. Added since 0.8.0
Shape:destroy Explicitly destroys the Shape. Removed in 0.8.0
Shape:getBody Get the body the shape is attached to. Added since 0.7.0 Removed in 0.8.0
Shape:getBoundingBox Gets the bounding box of the shape. Removed in 0.8.0
Shape:getCategory Gets the categories this shape is a member of. Removed in 0.8.0
Shape:getCategoryBits Gets the categories as a 16-bit integer. Removed in 0.8.0
Shape:getChildCount Returns the number of children the shape has. Added since 0.8.0
Shape:getData Get the data set with setData. Removed in 0.8.0
Shape:getDensity Gets the density of the Shape. Removed in 0.8.0
Shape:getFilterData Gets the filter data of the Shape. Removed in 0.8.0
Shape:getFriction Gets the friction of this shape. Removed in 0.8.0
Shape:getMask Gets which categories this shape should NOT collide with. Removed in 0.8.0
Shape:getRadius Gets the radius of the shape.
Shape:getRestitution Gets the restitution of this shape. Removed in 0.8.0
Shape:getType Gets a string representing the Shape.
Shape:isSensor Checks whether a Shape is a sensor or not. Removed in 0.8.0
Shape:rayCast Casts a ray against the shape. Added since 0.8.0
Shape:setCategory Sets the categories this shape is a member of. Removed in 0.8.0
Shape:setData Set data to be passed to the collision callback. Removed in 0.8.0
Shape:setDensity Sets the density of a Shape. Removed in 0.8.0
Shape:setFilterData Sets the filter data for a Shape. Removed in 0.8.0
Shape:setFriction Sets the friction of the shape. Removed in 0.8.0
Shape:setMask Sets which categories this shape should NOT collide with. Removed in 0.8.0
Shape:setRestitution Sets the restitution of the shape. Removed in 0.8.0
Shape:setSensor Sets whether this shape should act as a sensor. Removed in 0.8.0
Shape:testPoint Checks whether a point lies inside the shape.
Shape:testSegment Checks whether a line segment intersects a shape. Removed in 0.8.0

Enums

ShapeType The different types of Shapes, as returned by Shape:getType.

Supertypes

Subtypes

ChainShape A ChainShape consists of multiple line segments.
CircleShape Circle extends Shape and adds a radius and a local position.
EdgeShape EdgeShape is a line segment.
PolygonShape Polygon is a convex polygon with up to 8 sides.

See Also


Other Languages