Shape

Edit

A Shape is a physics object that can be attached to colliders to define their shape.

Constructors

lovr.physics.newBoxShapeCreate a new BoxShape.
lovr.physics.newSphereShapeCreate a new SphereShape.
lovr.physics.newCapsuleShapeCreate a new CapsuleShape.
lovr.physics.newCylinderShapeCreate a new CylinderShape.
lovr.physics.newConvexShapeCreate a new ConvexShape.
lovr.physics.newMeshShapeCreate a new MeshShape.
lovr.physics.newTerrainShapeCreate a new TerrainShape.
World:newBoxColliderAdd a Collider with a BoxShape to the World.
World:newSphereColliderAdd a Collider with a SphereShape to the World.
World:newCapsuleColliderAdd a Collider with a CapsuleShape to the World.
World:newCylinderColliderAdd a Collider with a CylinderShape to the World.
World:newConvexColliderAdd a Collider with a ConvexShape to the World.
World:newMeshColliderAdd a Collider with a MeshShape to the World.
World:newTerrainColliderAdd a Collider with a TerrainShape to the World.

Basics

Shape:getTypeGet the type of the Shape.
Shape:destroyDestroy the Shape.
Shape:isDestroyedCheck if the Shape is destroyed.
Shape:getColliderGet the Collider the Shape is attached to.
Shape:getUserDataGet the Lua value associated with the Shape.
Shape:setUserDataAssociate a Lua value with the Shape.

Position

Shape:getOffsetGet the local offset of the Shape.
Shape:setOffsetSet the local offset of the Shape.
Shape:getPositionGet the position of the Shape.
Shape:getOrientationGet the orientation of the Shape.
Shape:getPoseGet the pose of the Shape.
Shape:getAABBGet the Shape's axis aligned bounding box.

Mass

Shape:getVolumeGet the volume of the Shape.
Shape:getDensityGet the density of the Shape.
Shape:setDensitySet the density of the Shape.
Shape:getMassGet the mass of the Shape.
Shape:getInertiaGet the inertia of the Shape.
Shape:getCenterOfMassGet the center of mass of the Shape.

Queries

Shape:containsPointCheck if a point is inside the shape.
Shape:raycastCast a ray against the shape.

See also