love.physics (Français)

Disponible depuis LÖVE 0.4.0
Ce-tte module n'est pas supporté-e par des versions plus anciennes.

Peut simuler la physique 2D des corps rigides de manière réaliste. Ce module étant basé sur Box2D, cette API (interface de programmation) correspond aussi étroitement que possible à l'API Box2D .

Pour des cas plus simples (et plus communs), quelques bibliothèques existent, généralement utilisées de façon plus populaires que love.physics. On peut les trouver ici : https://github.com/love2d-community/awesome-love2d#physics

O.png Love.physics est ni léger et ni facile d' utilisation. C'est un véritable poids lourd conçu pour soulever de grosses charges.

Si vous voulez simplement faire un sauter un personnage sur des blocs ou faire des choses de ce genre, dites-vous qu'il n'y a rien à voir ici.

 


Types

Body (Français)Les corps (body) sont des objets avec une vélocité et une position.
Contact (Français)Les Contacts sont des objets crées pour gérer les collisions parmis les mondes.
Fixture (Français)Les points fixes (Fixture) attachent des Shape (formes) aux Body (corps).
Joint (Français)Attache plusieurs Body (corps) ensemble, afin d'interagir de façon unique.
Shape (Français)Les Shapes sont des objets pour contrôler les masses et les collisions.
World (Français)Un World (monde) est un objet qui contient des Body (corps) et des Joint (jointures).

Fonctions

love.physics.getDistanceReturns the two closest points between two fixtures and their distance.
love.physics.getMeterReturns the meter scale factor.
love.physics.newBodyCreates a new body.
love.physics.newChainShapeCreates a new ChainShape.
love.physics.newCircleShapeCreates a new CircleShape.
love.physics.newDistanceJointCreates a DistanceJoint between two bodies.
love.physics.newEdgeShapeCreates a new EdgeShape.
love.physics.newFixtureCreates and attaches a fixture.
love.physics.newFrictionJointA FrictionJoint applies friction to a body.
love.physics.newGearJointCreate a GearJoint connecting two Joints.
love.physics.newMotorJointCreates a joint between two bodies which controls the relative motion between them.
love.physics.newMouseJointCreate a joint between a body and the mouse.
love.physics.newPolygonShapeCreates a new PolygonShape.
love.physics.newPrismaticJointCreates a PrismaticJoint between two bodies.
love.physics.newPulleyJointCreates a PulleyJoint to join two bodies to each other and the ground.
love.physics.newRectangleShapeShorthand for creating rectangular PolygonShapes.
love.physics.newRevoluteJointCreates a pivot joint between two bodies.
love.physics.newRopeJointCreates a joint between two bodies that enforces a max distance between them.
love.physics.newWeldJointA WeldJoint essentially glues two bodies together.
love.physics.newWheelJointCreates a wheel joint.
love.physics.newWorldCreates a new World.
love.physics.setMeterSets the meter scale factor.

Voir aussi

Autres langues