Shape

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.newChainShapeCreates a new ChainShape.Added since 0.8.0
love.physics.newCircleShapeCreates a new CircleShape.
love.physics.newEdgeShapeCreates a new EdgeShape.Added since 0.8.0
love.physics.newPolygonShapeCreates a new PolygonShape.
love.physics.newRectangleShapeShorthand for creating rectangluar PolygonShapes.

Functions

Object:typeGets the type of the object as a string.
Object:typeOfChecks whether an object is of a certain type.
Shape:computeAABBReturns the points of the bounding box for the transformed shape.Added since 0.8.0
Shape:computeMassComputes the mass properties for the shape.Added since 0.8.0
Shape:destroyExplicitly destroys the Shape. Removed in 0.8.0
Shape:getBodyGet the body the shape is attached to.Added since 0.7.0 Removed in 0.8.0
Shape:getBoundingBoxGets the bounding box of the shape. Removed in 0.8.0
Shape:getCategoryGets the categories this shape is a member of. Removed in 0.8.0
Shape:getCategoryBitsGets the categories as a 16-bit integer. Removed in 0.8.0
Shape:getChildCountReturns the number of children the shape has.Added since 0.8.0
Shape:getDataGet the data set with setData. Removed in 0.8.0
Shape:getDensityGets the density of the Shape. Removed in 0.8.0
Shape:getFilterDataGets the filter data of the Shape. Removed in 0.8.0
Shape:getFrictionGets the friction of this shape. Removed in 0.8.0
Shape:getMaskGets which categories this shape should NOT collide with. Removed in 0.8.0
Shape:getRadiusGets the radius of the shape.
Shape:getRestitutionGets the restitution of this shape. Removed in 0.8.0
Shape:getTypeGets a string representing the Shape.
Shape:isSensorChecks whether a Shape is a sensor or not. Removed in 0.8.0
Shape:rayCastCasts a ray against the shape.Added since 0.8.0
Shape:setCategorySets the categories this shape is a member of. Removed in 0.8.0
Shape:setDataSet data to be passed to the collision callback. Removed in 0.8.0
Shape:setDensitySets the density of a Shape. Removed in 0.8.0
Shape:setFilterDataSets the filter data for a Shape. Removed in 0.8.0
Shape:setFrictionSets the friction of the shape. Removed in 0.8.0
Shape:setMaskSets which categories this shape should NOT collide with. Removed in 0.8.0
Shape:setRestitutionSets the restitution of the shape. Removed in 0.8.0
Shape:setSensorSets whether this shape should act as a sensor. Removed in 0.8.0
Shape:testPointChecks whether a point lies inside the shape.
Shape:testSegmentChecks whether a line segment intersects a shape. Removed in 0.8.0

Enums

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

Supertypes

Subtypes

ChainShapeA ChainShape consists of multiple line segments.
CircleShapeCircle extends Shape and adds a radius and a local position.
EdgeShapeEdgeShape is a line segment.
PolygonShapePolygon is a convex polygon with up to 8 sides.

See Also


Other Languages

Personal tools