lovr.physics

Edit

The lovr.physics module simulates 3D rigid body physics.

World

A World holds all of the objects in a physics simulation. Use methods like World:newBoxCollider to add objects to the world. Call World:update each frame to advance the physics simulation and calculate new positions for all the colliders.

lovr.physics.newWorldCreate a new World.

Colliders

A Collider is a single "object" in the physics world. A Collider has zero or more Shape objects attached to it, which determine its collision shape. Colliders can be connected together with Joint objects.

World:newColliderAdd a Collider to the World.
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.

Shapes

Shapes define the collision shape of a collider. Normally it isn't necessary to create shapes manually, instead convenience methods like World:newSphereCollider will create a collider with a shape attached.

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.

Joints

Joints connect colliders together and constrain their movement in various ways.

lovr.physics.newWeldJointCreate a new WeldJoint.
lovr.physics.newBallJointCreate a new BallJoint.
lovr.physics.newConeJointCreate a new ConeJoint.
lovr.physics.newDistanceJointCreate a new DistanceJoint.
lovr.physics.newHingeJointCreate a new HingeJoint.
lovr.physics.newSliderJointCreate a new SliderJoint.