diff options
Diffstat (limited to 'meta/3rd/love2d/library/love.physics.lua')
-rw-r--r-- | meta/3rd/love2d/library/love.physics.lua | 233 |
1 files changed, 175 insertions, 58 deletions
diff --git a/meta/3rd/love2d/library/love.physics.lua b/meta/3rd/love2d/library/love.physics.lua index 5c382108..7d3cd04d 100644 --- a/meta/3rd/love2d/library/love.physics.lua +++ b/meta/3rd/love2d/library/love.physics.lua @@ -42,9 +42,11 @@ function love.physics.getMeter() end ---The mass of the body gets calculated when a Fixture is attached or removed, but can be changed at any time with Body:setMass or Body:resetMassData. --- ---@param world love.World # The world to create the body in. ----@param type love.BodyType # The type of the body. +---@param x? number # The x position of the body. +---@param y? number # The y position of the body. +---@param type? love.BodyType # The type of the body. ---@return love.Body body # A new body. -function love.physics.newBody(world, type) end +function love.physics.newBody(world, x, y, type) end --- ---Creates a new ChainShape. @@ -77,7 +79,7 @@ function love.physics.newCircleShape(radius) end ---@param y1 number # The y position of the first anchor point (world space). ---@param x2 number # The x position of the second anchor point (world space). ---@param y2 number # The y position of the second anchor point (world space). ----@param collideConnected boolean # Specifies whether the two bodies should collide with each other. +---@param collideConnected? boolean # Specifies whether the two bodies should collide with each other. ---@return love.DistanceJoint joint # The new distance joint. function love.physics.newDistanceJoint(body1, body2, x1, y1, x2, y2, collideConnected) end @@ -98,7 +100,7 @@ function love.physics.newEdgeShape(x1, y1, x2, y2) end --- ---@param body love.Body # The body which gets the fixture attached. ---@param shape love.Shape # The shape to be copied to the fixture. ----@param density number # The density of the fixture. +---@param density? number # The density of the fixture. ---@return love.Fixture fixture # The new fixture. function love.physics.newFixture(body, shape, density) end @@ -108,9 +110,11 @@ function love.physics.newFixture(body, shape, density) end ---@overload fun(body1: love.Body, body2: love.Body, x1: number, y1: number, x2: number, y2: number, collideConnected: boolean):love.FrictionJoint ---@param body1 love.Body # The first body to attach to the joint. ---@param body2 love.Body # The second body to attach to the joint. ----@param collideConnected boolean # Specifies whether the two bodies should collide with each other. +---@param x number # The x position of the anchor point. +---@param y number # The y position of the anchor point. +---@param collideConnected? boolean # Specifies whether the two bodies should collide with each other. ---@return love.FrictionJoint joint # The new FrictionJoint. -function love.physics.newFrictionJoint(body1, body2, collideConnected) end +function love.physics.newFrictionJoint(body1, body2, x, y, collideConnected) end --- ---Create a GearJoint connecting two Joints. @@ -121,8 +125,8 @@ function love.physics.newFrictionJoint(body1, body2, collideConnected) end --- ---@param joint1 love.Joint # The first joint to connect with a gear joint. ---@param joint2 love.Joint # The second joint to connect with a gear joint. ----@param ratio number # The gear ratio. ----@param collideConnected boolean # Specifies whether the two bodies should collide with each other. +---@param ratio? number # The gear ratio. +---@param collideConnected? boolean # Specifies whether the two bodies should collide with each other. ---@return love.GearJoint joint # The new gear joint. function love.physics.newGearJoint(joint1, joint2, ratio, collideConnected) end @@ -134,7 +138,7 @@ function love.physics.newGearJoint(joint1, joint2, ratio, collideConnected) end ---@overload fun(body1: love.Body, body2: love.Body, correctionFactor: number, collideConnected: boolean):love.MotorJoint ---@param body1 love.Body # The first body to attach to the joint. ---@param body2 love.Body # The second body to attach to the joint. ----@param correctionFactor number # The joint's initial position correction factor, in the range of 1. +---@param correctionFactor? number # The joint's initial position correction factor, in the range of 1. ---@return love.MotorJoint joint # The new MotorJoint. function love.physics.newMotorJoint(body1, body2, correctionFactor) end @@ -146,8 +150,10 @@ function love.physics.newMotorJoint(body1, body2, correctionFactor) end ---The advantage of using a MouseJoint instead of just changing a body position directly is that collisions and reactions to other joints are handled by the physics engine. --- ---@param body love.Body # The body to attach to the mouse. +---@param x number # The x position of the connecting point. +---@param y number # The y position of the connecting point. ---@return love.MouseJoint joint # The new mouse joint. -function love.physics.newMouseJoint(body) end +function love.physics.newMouseJoint(body, x, y) end --- ---Creates a new PolygonShape. @@ -173,11 +179,13 @@ function love.physics.newPolygonShape(x1, y1, x2, y2, x3, y3) end ---@overload fun(body1: love.Body, body2: love.Body, x1: number, y1: number, x2: number, y2: number, ax: number, ay: number, collideConnected: boolean, referenceAngle: number):love.PrismaticJoint ---@param body1 love.Body # The first body to connect with a prismatic joint. ---@param body2 love.Body # The second body to connect with a prismatic joint. +---@param x number # The x coordinate of the anchor point. +---@param y number # The y coordinate of the anchor point. ---@param ax number # The x coordinate of the axis vector. ---@param ay number # The y coordinate of the axis vector. ----@param collideConnected boolean # Specifies whether the two bodies should collide with each other. +---@param collideConnected? boolean # Specifies whether the two bodies should collide with each other. ---@return love.PrismaticJoint joint # The new prismatic joint. -function love.physics.newPrismaticJoint(body1, body2, ax, ay, collideConnected) end +function love.physics.newPrismaticJoint(body1, body2, x, y, ax, ay, collideConnected) end --- ---Creates a PulleyJoint to join two bodies to each other and the ground. @@ -196,8 +204,8 @@ function love.physics.newPrismaticJoint(body1, body2, ax, ay, collideConnected) ---@param y1 number # The y coordinate of the pulley joint anchor in the first body. ---@param x2 number # The x coordinate of the pulley joint anchor in the second body. ---@param y2 number # The y coordinate of the pulley joint anchor in the second body. ----@param ratio number # The joint ratio. ----@param collideConnected boolean # Specifies whether the two bodies should collide with each other. +---@param ratio? number # The joint ratio. +---@param collideConnected? boolean # Specifies whether the two bodies should collide with each other. ---@return love.PulleyJoint joint # The new pulley joint. function love.physics.newPulleyJoint(body1, body2, gx1, gy1, gx2, gy2, x1, y1, x2, y2, ratio, collideConnected) end @@ -220,9 +228,11 @@ function love.physics.newRectangleShape(width, height) end ---@overload fun(body1: love.Body, body2: love.Body, x1: number, y1: number, x2: number, y2: number, collideConnected: boolean, referenceAngle: number):love.RevoluteJoint ---@param body1 love.Body # The first body. ---@param body2 love.Body # The second body. ----@param collideConnected boolean # Specifies whether the two bodies should collide with each other. +---@param x number # The x position of the connecting point. +---@param y number # The y position of the connecting point. +---@param collideConnected? boolean # Specifies whether the two bodies should collide with each other. ---@return love.RevoluteJoint joint # The new revolute joint. -function love.physics.newRevoluteJoint(body1, body2, collideConnected) end +function love.physics.newRevoluteJoint(body1, body2, x, y, collideConnected) end --- ---Creates a joint between two bodies. Its only function is enforcing a max distance between these bodies. @@ -234,7 +244,7 @@ function love.physics.newRevoluteJoint(body1, body2, collideConnected) end ---@param x2 number # The x position of the second anchor point. ---@param y2 number # The y position of the second anchor point. ---@param maxLength number # The maximum distance for the bodies. ----@param collideConnected boolean # Specifies whether the two bodies should collide with each other. +---@param collideConnected? boolean # Specifies whether the two bodies should collide with each other. ---@return love.RopeJoint joint # The new RopeJoint. function love.physics.newRopeJoint(body1, body2, x1, y1, x2, y2, maxLength, collideConnected) end @@ -245,9 +255,11 @@ function love.physics.newRopeJoint(body1, body2, x1, y1, x2, y2, maxLength, coll ---@overload fun(body1: love.Body, body2: love.Body, x1: number, y1: number, x2: number, y2: number, collideConnected: boolean, referenceAngle: number):love.WeldJoint ---@param body1 love.Body # The first body to attach to the joint. ---@param body2 love.Body # The second body to attach to the joint. ----@param collideConnected boolean # Specifies whether the two bodies should collide with each other. +---@param x number # The x position of the anchor point (world space). +---@param y number # The y position of the anchor point (world space). +---@param collideConnected? boolean # Specifies whether the two bodies should collide with each other. ---@return love.WeldJoint joint # The new WeldJoint. -function love.physics.newWeldJoint(body1, body2, collideConnected) end +function love.physics.newWeldJoint(body1, body2, x, y, collideConnected) end --- ---Creates a wheel joint. @@ -255,18 +267,20 @@ function love.physics.newWeldJoint(body1, body2, collideConnected) end ---@overload fun(body1: love.Body, body2: love.Body, x1: number, y1: number, x2: number, y2: number, ax: number, ay: number, collideConnected: boolean):love.WheelJoint ---@param body1 love.Body # The first body. ---@param body2 love.Body # The second body. +---@param x number # The x position of the anchor point. +---@param y number # The y position of the anchor point. ---@param ax number # The x position of the axis unit vector. ---@param ay number # The y position of the axis unit vector. ----@param collideConnected boolean # Specifies whether the two bodies should collide with each other. +---@param collideConnected? boolean # Specifies whether the two bodies should collide with each other. ---@return love.WheelJoint joint # The new WheelJoint. -function love.physics.newWheelJoint(body1, body2, ax, ay, collideConnected) end +function love.physics.newWheelJoint(body1, body2, x, y, ax, ay, collideConnected) end --- ---Creates a new World. --- ----@param xg number # The x component of gravity. ----@param yg number # The y component of gravity. ----@param sleep boolean # Whether the bodies in this world are allowed to sleep. +---@param xg? number # The x component of gravity. +---@param yg? number # The y component of gravity. +---@param sleep? boolean # Whether the bodies in this world are allowed to sleep. ---@return love.World world # A brave new World. function love.physics.newWorld(xg, yg, sleep) end @@ -370,6 +384,7 @@ function Body:getAngularDamping() end --- ---If you need the ''rate of change of position over time'', use Body:getLinearVelocity. --- +---@return number w # The angular velocity in radians/second. function Body:getAngularVelocity() end --- @@ -429,6 +444,8 @@ function Body:getLinearDamping() end --- ---See page 136 of 'Essential Mathematics for Games and Interactive Applications' for definitions of local and world coordinates. --- +---@return number x # The x-component of the velocity vector +---@return number y # The y-component of the velocity vector function Body:getLinearVelocity() end --- @@ -438,9 +455,11 @@ function Body:getLinearVelocity() end --- ---The point on the body must given in local coordinates. Use Body:getLinearVelocityFromWorldPoint to specify this with world coordinates. --- +---@param x number # The x position to measure velocity. +---@param y number # The y position to measure velocity. ---@return number vx # The x component of velocity at point (x,y). ---@return number vy # The y component of velocity at point (x,y). -function Body:getLinearVelocityFromLocalPoint() end +function Body:getLinearVelocityFromLocalPoint(x, y) end --- ---Get the linear velocity of a point on the body. @@ -449,15 +468,19 @@ function Body:getLinearVelocityFromLocalPoint() end --- ---The point on the body must given in world coordinates. Use Body:getLinearVelocityFromLocalPoint to specify this with local coordinates. --- +---@param x number # The x position to measure velocity. +---@param y number # The y position to measure velocity. ---@return number vx # The x component of velocity at point (x,y). ---@return number vy # The y component of velocity at point (x,y). -function Body:getLinearVelocityFromWorldPoint() end +function Body:getLinearVelocityFromWorldPoint(x, y) end --- ---Get the center of mass position in local coordinates. --- ---Use Body:getWorldCenter to get the center of mass in world coordinates. --- +---@return number x # The x coordinate of the center of mass. +---@return number y # The y coordinate of the center of mass. function Body:getLocalCenter() end --- @@ -489,6 +512,8 @@ function Body:getMass() end --- ---Returns the mass, its center, and the rotational inertia. --- +---@return number x # The x position of the center of mass. +---@return number y # The y position of the center of mass. ---@return number mass # The mass of the body. ---@return number inertia # The rotational inertia. function Body:getMassData() end @@ -498,6 +523,8 @@ function Body:getMassData() end --- ---Note that this may not be the center of mass of the body. --- +---@return number x # The x position. +---@return number y # The y position. function Body:getPosition() end --- @@ -505,6 +532,8 @@ function Body:getPosition() end --- ---Note that the position may not be the center of mass of the body. An angle of 0 radians will mean 'looking to the right'. Although radians increase counter-clockwise, the y axis points down so it becomes clockwise from our point of view. --- +---@return number x # The x component of the position. +---@return number y # The y component of the position. ---@return number angle # The angle in radians. function Body:getTransform() end @@ -531,6 +560,8 @@ function Body:getWorld() end --- ---Use Body:getLocalCenter to get the center of mass in local coordinates. --- +---@return number x # The x coordinate of the center of mass. +---@return number y # The y coordinate of the center of mass. function Body:getWorldCenter() end --- @@ -567,11 +598,13 @@ function Body:getWorldVector(localX, localY) end --- ---Get the x position of the body in world coordinates. --- +---@return number x # The x position in world coordinates. function Body:getX() end --- ---Get the y position of the body in world coordinates. --- +---@return number y # The y position in world coordinates. function Body:getY() end --- @@ -669,7 +702,8 @@ function Body:setAngularDamping(damping) end --- ---This function will not accumulate anything; any impulses previously applied since the last call to World:update will be lost. --- -function Body:setAngularVelocity() end +---@param w number # The new angular velocity, in radians per second +function Body:setAngularVelocity(w) end --- ---Wakes the body up or puts it to sleep. @@ -728,7 +762,9 @@ function Body:setLinearDamping(ld) end --- ---This function will not accumulate anything; any impulses previously applied since the last call to World:update will be lost. --- -function Body:setLinearVelocity() end +---@param x number # The x-component of the velocity vector. +---@param y number # The y-component of the velocity vector. +function Body:setLinearVelocity(x, y) end --- ---Sets a new body mass. @@ -739,9 +775,11 @@ function Body:setMass(mass) end --- ---Overrides the calculated mass data. --- +---@param x number # The x position of the center of mass. +---@param y number # The y position of the center of mass. ---@param mass number # The mass of the body. ---@param inertia number # The rotational inertia. -function Body:setMassData(mass, inertia) end +function Body:setMassData(x, y, mass, inertia) end --- ---Set the position of the body. @@ -750,7 +788,9 @@ function Body:setMassData(mass, inertia) end --- ---This function cannot wake up the body. --- -function Body:setPosition() end +---@param x number # The x position. +---@param y number # The y position. +function Body:setPosition(x, y) end --- ---Sets the sleeping behaviour of the body. Should sleeping be allowed, a body at rest will automatically sleep. A sleeping body is not simulated unless it collided with an awake body. Be wary that one can end up with a situation like a floating sleeping body if the floor was removed. @@ -765,8 +805,10 @@ function Body:setSleepingAllowed(allowed) end --- ---This function cannot wake up the body. --- +---@param x number # The x component of the position. +---@param y number # The y component of the position. ---@param angle number # The angle in radians. -function Body:setTransform(angle) end +function Body:setTransform(x, y, angle) end --- ---Sets a new body type. @@ -787,14 +829,16 @@ function Body:setUserData(value) end --- ---This function cannot wake up the body. --- -function Body:setX() end +---@param x number # The x position. +function Body:setX(x) end --- ---Set the y position of the body. --- ---This function cannot wake up the body. --- -function Body:setY() end +---@param y number # The y position. +function Body:setY(y) end --- ---A ChainShape consists of multiple line segments. It can be used to create the boundaries of your terrain. The shape does not have volume and can only collide with PolygonShape and CircleShape. @@ -816,12 +860,16 @@ function ChainShape:getChildEdge(index) end --- ---Setting next and previous ChainShape vertices can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape. --- +---@return number x # The x-component of the vertex, or nil if ChainShape:setNextVertex hasn't been called. +---@return number y # The y-component of the vertex, or nil if ChainShape:setNextVertex hasn't been called. function ChainShape:getNextVertex() end --- ---Returns a point of the shape. --- ---@param index number # The index of the point to return. +---@return number x # The x-coordinate of the point. +---@return number y # The y-coordinate of the point. function ChainShape:getPoint(index) end --- @@ -838,6 +886,8 @@ function ChainShape:getPoints() end --- ---Setting next and previous ChainShape vertices can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape. --- +---@return number x # The x-component of the vertex, or nil if ChainShape:setPreviousVertex hasn't been called. +---@return number y # The y-component of the vertex, or nil if ChainShape:setPreviousVertex hasn't been called. function ChainShape:getPreviousVertex() end --- @@ -851,14 +901,18 @@ function ChainShape:getVertexCount() end --- ---This can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape. --- -function ChainShape:setNextVertex() end +---@param x number # The x-component of the vertex. +---@param y number # The y-component of the vertex. +function ChainShape:setNextVertex(x, y) end --- ---Sets a vertex that establishes a connection to the previous shape. --- ---This can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape. --- -function ChainShape:setPreviousVertex() end +---@param x number # The x-component of the vertex. +---@param y number # The y-component of the vertex. +function ChainShape:setPreviousVertex(x, y) end --- ---Circle extends Shape and adds a radius and a local position. @@ -869,6 +923,8 @@ local CircleShape = {} --- ---Gets the center point of the circle shape. --- +---@return number x # The x-component of the center point of the circle. +---@return number y # The y-component of the center point of the circle. function CircleShape:getPoint() end --- @@ -880,7 +936,9 @@ function CircleShape:getRadius() end --- ---Sets the location of the center of the circle shape. --- -function CircleShape:setPoint() end +---@param x number # The x-component of the new center point of the circle. +---@param y number # The y-component of the new center point of the circle. +function CircleShape:setPoint(x, y) end --- ---Sets the radius of the circle. @@ -992,6 +1050,7 @@ function DistanceJoint:getFrequency() end --- ---Gets the equilibrium distance between the two Bodies. --- +---@return number l # The length between the two Bodies. function DistanceJoint:getLength() end --- @@ -1009,7 +1068,8 @@ function DistanceJoint:setFrequency(Hz) end --- ---Sets the equilibrium distance between the two Bodies. --- -function DistanceJoint:setLength() end +---@param l number # The length between the two Bodies. +function DistanceJoint:setLength(l) end --- ---A EdgeShape is a line segment. They can be used to create the boundaries of your terrain. The shape does not have volume and can only collide with PolygonShape and CircleShape. @@ -1022,6 +1082,8 @@ local EdgeShape = {} --- ---Setting next and previous EdgeShape vertices can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape. --- +---@return number x # The x-component of the vertex, or nil if EdgeShape:setNextVertex hasn't been called. +---@return number y # The y-component of the vertex, or nil if EdgeShape:setNextVertex hasn't been called. function EdgeShape:getNextVertex() end --- @@ -1038,6 +1100,8 @@ function EdgeShape:getPoints() end --- ---Setting next and previous EdgeShape vertices can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape. --- +---@return number x # The x-component of the vertex, or nil if EdgeShape:setPreviousVertex hasn't been called. +---@return number y # The y-component of the vertex, or nil if EdgeShape:setPreviousVertex hasn't been called. function EdgeShape:getPreviousVertex() end --- @@ -1045,14 +1109,18 @@ function EdgeShape:getPreviousVertex() end --- ---This can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape. --- -function EdgeShape:setNextVertex() end +---@param x number # The x-component of the vertex. +---@param y number # The y-component of the vertex. +function EdgeShape:setNextVertex(x, y) end --- ---Sets a vertex that establishes a connection to the previous shape. --- ---This can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape. --- -function EdgeShape:setPreviousVertex() end +---@param x number # The x-component of the vertex. +---@param y number # The y-component of the vertex. +function EdgeShape:setPreviousVertex(x, y) end --- ---Fixtures attach shapes to bodies. @@ -1074,7 +1142,7 @@ function Fixture:getBody() end --- ---Returns the points of the fixture bounding box. In case the fixture has multiple children a 1-based index can be specified. For example, a fixture will have multiple children with a chain shape. --- ----@param index number # A bounding box of the fixture. +---@param index? number # A bounding box of the fixture. ---@return number topLeftX # The x position of the top-left point. ---@return number topLeftY # The y position of the top-left point. ---@return number bottomRightX # The x position of the bottom-right point. @@ -1128,6 +1196,8 @@ function Fixture:getMask() end --- ---Returns the mass, its center and the rotational inertia. --- +---@return number x # The x position of the center of mass. +---@return number y # The y position of the center of mass. ---@return number mass # The mass of the fixture. ---@return number inertia # The rotational inertia. function Fixture:getMassData() end @@ -1178,7 +1248,7 @@ function Fixture:isSensor() end ---@param x2 number # The x position of the input line end point. ---@param y2 number # The y position of the input line end point. ---@param maxFraction number # Ray length parameter. ----@param childIndex number # The index of the child the ray gets cast against. +---@param childIndex? number # The index of the child the ray gets cast against. ---@return number xn # The x component of the normal vector of the edge where the ray hit the shape. ---@return number yn # The y component of the normal vector of the edge where the ray hit the shape. ---@return number fraction # The position on the input line where the intersection happened as a factor of the line length. @@ -1267,8 +1337,10 @@ function Fixture:setUserData(value) end --- ---Checks if a point is inside the shape of the fixture. --- +---@param x number # The x position of the point. +---@param y number # The y position of the point. ---@return boolean isInside # True if the point is inside or false if it is outside. -function Fixture:testPoint() end +function Fixture:testPoint(x, y) end --- ---A FrictionJoint applies friction to a body. @@ -1359,12 +1431,16 @@ function Joint:getBodies() end --- ---Gets whether the connected Bodies collide. --- +---@return boolean c # True if they collide, false otherwise. function Joint:getCollideConnected() end --- ---Returns the reaction force in newtons on the second body --- -function Joint:getReactionForce() end +---@param x number # How long the force applies. Usually the inverse time step or 1/dt. +---@return number x # The x-component of the force. +---@return number y # The y-component of the force. +function Joint:getReactionForce(x) end --- ---Returns the reaction torque on the second body. @@ -1414,6 +1490,8 @@ function MotorJoint:getAngularOffset() end --- ---Gets the target linear offset between the two Bodies the Joint is attached to. --- +---@return number x # The x component of the target linear offset, relative to the first Body. +---@return number y # The y component of the target linear offset, relative to the first Body. function MotorJoint:getLinearOffset() end --- @@ -1425,7 +1503,9 @@ function MotorJoint:setAngularOffset(angleoffset) end --- ---Sets the target linear offset between the two Bodies the Joint is attached to. --- -function MotorJoint:setLinearOffset() end +---@param x number # The x component of the target linear offset, relative to the first Body. +---@param y number # The y component of the target linear offset, relative to the first Body. +function MotorJoint:setLinearOffset(x, y) end --- ---For controlling objects with the mouse. @@ -1448,11 +1528,14 @@ function MouseJoint:getFrequency() end --- ---Gets the highest allowed force. --- +---@return number f # The max allowed force. function MouseJoint:getMaxForce() end --- ---Gets the target point. --- +---@return number x # The x-component of the target. +---@return number y # The x-component of the target. function MouseJoint:getTarget() end --- @@ -1470,12 +1553,15 @@ function MouseJoint:setFrequency(freq) end --- ---Sets the highest allowed force. --- -function MouseJoint:setMaxForce() end +---@param f number # The max allowed force. +function MouseJoint:setMaxForce(f) end --- ---Sets the target point. --- -function MouseJoint:setTarget() end +---@param x number # The x-component of the target. +---@param y number # The y-component of the target. +function MouseJoint:setTarget(x, y) end --- ---A PolygonShape is a convex polygon with up to 8 vertices. @@ -1509,16 +1595,20 @@ function PrismaticJoint:areLimitsEnabled() end --- ---Gets the world-space axis vector of the Prismatic Joint. --- +---@return number x # The x-axis coordinate of the world-space axis vector. +---@return number y # The y-axis coordinate of the world-space axis vector. function PrismaticJoint:getAxis() end --- ---Get the current joint angle speed. --- +---@return number s # Joint angle speed in meters/second. function PrismaticJoint:getJointSpeed() end --- ---Get the current joint translation. --- +---@return number t # Joint translation, usually in meters.. function PrismaticJoint:getJointTranslation() end --- @@ -1537,6 +1627,7 @@ function PrismaticJoint:getLowerLimit() end --- ---Gets the maximum motor force. --- +---@return number f # The maximum motor force, usually in N. function PrismaticJoint:getMaxMotorForce() end --- @@ -1549,6 +1640,7 @@ function PrismaticJoint:getMotorForce(invdt) end --- ---Gets the motor speed. --- +---@return number s # The motor speed, usually in meters per second. function PrismaticJoint:getMotorSpeed() end --- @@ -1585,7 +1677,8 @@ function PrismaticJoint:setLowerLimit(lower) end --- ---Set the maximum motor force. --- -function PrismaticJoint:setMaxMotorForce() end +---@param f number # The maximum motor force, usually in N. +function PrismaticJoint:setMaxMotorForce(f) end --- ---Enables/disables the joint motor. @@ -1596,7 +1689,8 @@ function PrismaticJoint:setMotorEnabled(enable) end --- ---Sets the motor speed. --- -function PrismaticJoint:setMotorSpeed() end +---@param s number # The motor speed, usually in meters per second. +function PrismaticJoint:setMotorSpeed(s) end --- ---Sets the upper limit. @@ -1694,6 +1788,7 @@ function RevoluteJoint:getJointAngle() end --- ---Get the current joint angle speed. --- +---@return number s # Joint angle speed in radians/second. function RevoluteJoint:getJointSpeed() end --- @@ -1712,16 +1807,19 @@ function RevoluteJoint:getLowerLimit() end --- ---Gets the maximum motor force. --- +---@return number f # The maximum motor force, in Nm. function RevoluteJoint:getMaxMotorTorque() end --- ---Gets the motor speed. --- +---@return number s # The motor speed, radians per second. function RevoluteJoint:getMotorSpeed() end --- ---Get the current motor force. --- +---@return number f # The current motor force, in Nm. function RevoluteJoint:getMotorTorque() end --- @@ -1764,7 +1862,8 @@ function RevoluteJoint:setLowerLimit(lower) end --- ---Set the maximum motor force. --- -function RevoluteJoint:setMaxMotorTorque() end +---@param f number # The maximum motor force, in Nm. +function RevoluteJoint:setMaxMotorTorque(f) end --- ---Enables/disables the joint motor. @@ -1775,7 +1874,8 @@ function RevoluteJoint:setMotorEnabled(enable) end --- ---Sets the motor speed. --- -function RevoluteJoint:setMotorSpeed() end +---@param s number # The motor speed, radians per second. +function RevoluteJoint:setMotorSpeed(s) end --- ---Sets the upper limit. @@ -1817,7 +1917,7 @@ local Shape = {} ---@param tx number # The translation of the shape on the x-axis. ---@param ty number # The translation of the shape on the y-axis. ---@param tr number # The shape rotation. ----@param childIndex number # The index of the child to compute the bounding box of. +---@param childIndex? number # The index of the child to compute the bounding box of. ---@return number topLeftX # The x position of the top-left point. ---@return number topLeftY # The y position of the top-left point. ---@return number bottomRightX # The x position of the bottom-right point. @@ -1828,6 +1928,8 @@ function Shape:computeAABB(tx, ty, tr, childIndex) end ---Computes the mass properties for the shape with the specified density. --- ---@param density number # The shape density. +---@return number x # The x postition of the center of mass. +---@return number y # The y postition of the center of mass. ---@return number mass # The mass of the shape. ---@return number inertia # The rotational inertia. function Shape:computeMass(density) end @@ -1871,7 +1973,7 @@ function Shape:getType() end ---@param tx number # The translation of the shape on the x-axis. ---@param ty number # The translation of the shape on the y-axis. ---@param tr number # The shape rotation. ----@param childIndex number # The index of the child the ray gets cast against. +---@param childIndex? number # The index of the child the ray gets cast against. ---@return number xn # The x component of the normal vector of the edge where the ray hit the shape. ---@return number yn # The y component of the normal vector of the edge where the ray hit the shape. ---@return number fraction # The position on the input line where the intersection happened as a factor of the line length. @@ -1883,8 +1985,10 @@ function Shape:rayCast(x1, y1, x2, y2, maxFraction, tx, ty, tr, childIndex) end ---@param tx number # Translates the shape along the x-axis. ---@param ty number # Translates the shape along the y-axis. ---@param tr number # Rotates the shape. +---@param x number # The x-component of the point. +---@param y number # The y-component of the point. ---@return boolean hit # True if inside, false if outside -function Shape:testPoint(tx, ty, tr) end +function Shape:testPoint(tx, ty, tr, x, y) end --- ---A WeldJoint essentially glues two bodies together. @@ -1925,6 +2029,8 @@ local WheelJoint = {} --- ---Gets the world-space axis vector of the Wheel Joint. --- +---@return number x # The x-axis coordinate of the world-space axis vector. +---@return number y # The y-axis coordinate of the world-space axis vector. function WheelJoint:getAxis() end --- @@ -2022,6 +2128,7 @@ function World:getBodies() end --- ---Returns the number of bodies in the world. --- +---@return number n # The number of bodies in the world. function World:getBodyCount() end --- @@ -2036,6 +2143,7 @@ function World:getCallbacks() end --- ---Returns the number of contacts in the world. --- +---@return number n # The number of contacts in the world. function World:getContactCount() end --- @@ -2053,11 +2161,14 @@ function World:getContacts() end --- ---Get the gravity of the world. --- +---@return number x # The x component of gravity. +---@return number y # The y component of gravity. function World:getGravity() end --- ---Returns the number of joints in the world. --- +---@return number n # The number of joints in the world. function World:getJointCount() end --- @@ -2100,11 +2211,13 @@ function World:queryBoundingBox(topLeftX, topLeftY, bottomRightX, bottomRightY, ---Casts a ray and calls a function for each fixtures it intersects. --- ---@param fixture love.Fixture # The fixture intersecting the ray. +---@param x number # The x position of the intersection point. +---@param y number # The y position of the intersection point. ---@param xn number # The x value of the surface normal vector of the shape edge. ---@param yn number # The y value of the surface normal vector of the shape edge. ---@param fraction number # The position of the intersection on the ray as a number from 0 to 1 (or even higher if the ray length was changed with the return value). ---@return number control # The ray can be controlled with the return value. A positive value sets a new ray length where 1 is the default value. A value of 0 terminates the ray. If the callback function returns -1, the intersection gets ignored as if it didn't happen. -function World:rayCast(fixture, xn, yn, fraction) end +function World:rayCast(fixture, x, y, xn, yn, fraction) end --- ---Sets functions for the collision callbacks during the world update. @@ -2132,7 +2245,9 @@ function World:setContactFilter(filter) end --- ---Set the gravity of the world. --- -function World:setGravity() end +---@param x number # The x component of gravity. +---@param y number # The y component of gravity. +function World:setGravity(x, y) end --- ---Sets the sleep behaviour of the world. @@ -2143,14 +2258,16 @@ function World:setSleepingAllowed(allow) end --- ---Translates the World's origin. Useful in large worlds where floating point precision issues become noticeable at far distances from the origin. --- -function World:translateOrigin() end +---@param x number # The x component of the new origin with respect to the old origin. +---@param y number # The y component of the new origin with respect to the old origin. +function World:translateOrigin(x, y) end --- ---Update the state of the world. --- ---@param dt number # The time (in seconds) to advance the physics simulation. ----@param velocityiterations number # The maximum number of steps used to determine the new velocities when resolving a collision. ----@param positioniterations number # The maximum number of steps used to determine the new positions when resolving a collision. +---@param velocityiterations? number # The maximum number of steps used to determine the new velocities when resolving a collision. +---@param positioniterations? number # The maximum number of steps used to determine the new positions when resolving a collision. function World:update(dt, velocityiterations, positioniterations) end --- |