love.physics (Tiếng Việt)

Có thể mô phỏng động lực của vật rắn 2 chiều một cách giống như thật. Module này được dựa trên Box2D, và API này tương ứng sát nhất với API của Box2D.

O.png love.physics không phải là thành phần nhẹ, và thậm chí không dễ sử dụng chút nào. Nó là một cây búa tạ mười tấn được thiết kế dành cho dũng sĩ nâng tạ. Nếu bạn chỉ thử làm một nhân vật trong trò chơi nhảy qua các khối hoặc chướng ngại vật thì thôi, không phải xem module này nữa.  

Kiểu

BodyBodies are objects with velocity and position.
ContactContacts are objects created to manage collisions in worlds.
FixtureFixtures attach shapes to bodies.
JointAttach multiple bodies together to interact in unique ways.
ShapeShapes are objects used to control mass and collisions.
WorldA world is an object that contains all bodies and joints.

Hàm

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.

Kiểu liệt kê

BodyTypeThe types of a Body.
JointTypeDifferent types of joints.
ShapeTypeThe different types of Shapes, as returned by Shape:getType.

Xem thêm


Ngôn ngữ khác