Nocare3/love2dapi_chunks huggingface dataset:
love.physics.newWheelJoint
Creates a wheel joint.
joint = love.physics.newWheelJoint( body1, body2, x, y, ax, ay, collideConnected )
body1 Body The first body.
body2 Body The second body.
x number The x position of the anchor point.
y number The y position of the anchor point.
ax number The x position of the axis unit vector.
ay number The y position of the axis unit vector.
collideConnected (false) boolean Specifies whether the two bodies should collide with each other.
joint WheelJoint The new WheelJoint.
joint = love.physics.newWheelJoint( body1, body2, x1, y1, x2, y2, ax, ay, collideConnected )
body1 Body The first body.
body2 Body The second body.
x1 number The x position of the first anchor point.
y1 number The y position of the first anchor point.
x2 number The x position of the second anchor point.
y2 number The y position of the second anchor point.
ax number The x position of the axis unit vector.
ay number The y position of the axis unit vector.
collideConnected (false) boolean Specifies whether the two bodies should collide with each other.
joint WheelJoint The new WheelJoint.
love.physics.newWorld
Creates a new World.
world = love.physics.newWorld( xg, yg, sleep )
xg (0) number The x component of gravity.
yg (0) number The y component of gravity.
sleep (true) boolean Whether the bodies in this world are allowed to sleep.
world World A brave new World.
love.physics.setMeter
Sets the pixels to meter scale factor.

All coordinates in the physics module are divided by this number and converted to meters, and it creates a convenient way to draw the objects directly to the screen without the need for graphics transformations.

It is recommended to create shapes no larger than 10 times the scale. This is important because Box2D is tuned to work well with shape sizes from 0.1 to 10 meters. The default meter scale is 30.
love.physics.setMeter( scale )
scale number The scale factor as an integer.
Body:applyAngularImpulse
Applies an angular impulse to a body. This makes a single, instantaneous addition to the body momentum.

A body with with a larger mass will react less. The reaction does '''not''' depend on the timestep, and is equivalent to applying a force continuously for 1 second. Impulses are best used to give a single push to a body. For a continuous push to a body it is better to use Body:applyForce.
Body:applyAngularImpulse( impulse )
impulse number The impulse in kilogram-square meter per second.
Body:applyForce
Apply force to a Body.

A force pushes a body in a direction. A body with with a larger mass will react less. The reaction also depends on how long a force is applied: since the force acts continuously over the entire timestep, a short timestep will only push the body for a short time. Thus forces are best used for many timesteps to give a continuous push to a body (like gravity). For a single push that is independent of timestep, it is better to use Body:applyLinearImpulse.

If the position to apply the force is not given, it will act on the center of mass of the body. The part of the force not directed towards the center of mass will cause the body to spin (and depends on the rotational inertia).

Note that the force components and position must be given in world coordinates.
Body:applyForce( fx, fy )
fx number The x component of force to apply to the center of mass.
fy number The y component of force to apply to the center of mass.
Body:applyForce( fx, fy, x, y )
fx number The x component of force to apply.
fy number The y component of force to apply.
x number The x position to apply the force.
y number The y position to apply the force.
Body:applyLinearImpulse
Applies an impulse to a body.

This makes a single, instantaneous addition to the body momentum.

An impulse pushes a body in a direction. A body with with a larger mass will react less. The reaction does '''not''' depend on the timestep, and is equivalent to applying a force continuously for 1 second. Impulses are best used to give a single push to a body. For a continuous push to a body it is better to use Body:applyForce.

If the position to apply the impulse is not given, it will act on the center of mass of the body. The part of the impulse not directed towards the center of mass will cause the body to spin (and depends on the rotational inertia).

Note that the impulse components and position must be given in world coordinates.
Body:applyLinearImpulse( ix, iy )
ix number The x component of the impulse applied to the center of mass.
iy number The y component of the impulse applied to the center of mass.
Body:applyLinearImpulse( ix, iy, x, y )
ix number The x component of the impulse.
iy number The y component of the impulse.
x number The x position to apply the impulse.
y number The y position to apply the impulse.
Body:applyTorque
Apply torque to a body.

Torque is like a force that will change the angular velocity (spin) of a body. The effect will depend on the rotational inertia a body has.
Body:applyTorque( torque )
torque number The torque to apply.
Body:destroy
Explicitly destroys the Body and all fixtures and joints attached to it.

An error will occur if you attempt to use the object after calling this function. In 0.7.2, when you don't have time to wait for garbage collection, this function may be used to free the object immediately.
Body:destroy()
Body:getAngle
Get the angle of the body.

The angle is measured in radians. If you need to transform it to degrees, use math.deg.

A value 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.
angle = Body:getAngle()
angle number The angle in radians.
Body:getAngularDamping
Gets the Angular damping of the Body

The angular damping is the ''rate of decrease of the angular velocity over time'': A spinning body with no damping and no external forces will continue spinning indefinitely. A spinning body with damping will gradually stop spinning.

Damping is not the same as friction - they can be modelled together. However, only damping is provided by Box2D (and LOVE).

Damping parameters should be between 0 and infinity, with 0 meaning no damping, and infinity meaning full damping. Normally you will use a damping value between 0 and 0.1.
damping = Body:getAngularDamping()
damping number The value of the angular damping.
Body:getAngularVelocity
Get the angular velocity of the Body.

The angular velocity is the ''rate of change of angle over time''.

It is changed in World:update by applying torques, off centre forces/impulses, and angular damping. It can be set directly with Body:setAngularVelocity.

If you need the ''rate of change of position over time'', use Body:getLinearVelocity.
w = Body:getAngularVelocity()
w number The angular velocity in radians/second.
Body:getContacts
Gets a list of all Contacts attached to the Body.
contacts = Body:getContacts()
contacts table A list with all contacts associated with the Body.
Body:getFixtures
Returns a table with all fixtures.
fixtures = Body:getFixtures()
fixtures table A sequence with all fixtures.
Body:getGravityScale
Returns the gravity scale factor.
scale = Body:getGravityScale()
scale number The gravity scale factor.
Body:getInertia
Gets the rotational inertia of the body.

The rotational inertia is how hard is it to make the body spin.
inertia = Body:getInertia()
inertia number The rotational inertial of the body.
Body:getJoints
Returns a table containing the Joints attached to this Body.
joints = Body:getJoints()
joints table A sequence with the Joints attached to the Body.
Body:getLinearDamping
Gets the linear damping of the Body.

The linear damping is the ''rate of decrease of the linear velocity over time''. A moving body with no damping and no external forces will continue moving indefinitely, as is the case in space. A moving body with damping will gradually stop moving.

Damping is not the same as friction - they can be modelled together.
damping = Body:getLinearDamping()
damping number The value of the linear damping.
Body:getLinearVelocity
Gets the linear velocity of the Body from its center of mass.

The linear velocity is the ''rate of change of position over time''.

If you need the ''rate of change of angle over time'', use Body:getAngularVelocity.

If you need to get the linear velocity of a point different from the center of mass:

* Body:getLinearVelocityFromLocalPoint allows you to specify the point in local coordinates.

* Body:getLinearVelocityFromWorldPoint allows you to specify the point in world coordinates.

See page 136 of 'Essential Mathematics for Games and Interactive Applications' for definitions of local and world coordinates.
x, y = Body:getLinearVelocity()
x number The x-component of the velocity vector
y number The y-component of the velocity vector
Body:getLinearVelocityFromLocalPoint
Get the linear velocity of a point on the body.

The linear velocity for a point on the body is the velocity of the body center of mass plus the velocity at that point from the body spinning.

The point on the body must given in local coordinates. Use Body:getLinearVelocityFromWorldPoint to specify this with world coordinates.
vx, vy = Body:getLinearVelocityFromLocalPoint( x, y )
x number The x position to measure velocity.
y number The y position to measure velocity.
vx number The x component of velocity at point (x,y).
vy number The y component of velocity at point (x,y).
Body:getLinearVelocityFromWorldPoint
Get the linear velocity of a point on the body.

The linear velocity for a point on the body is the velocity of the body center of mass plus the velocity at that point from the body spinning.

The point on the body must given in world coordinates. Use Body:getLinearVelocityFromLocalPoint to specify this with local coordinates.
vx, vy = Body:getLinearVelocityFromWorldPoint( x, y )
x number The x position to measure velocity.
y number The y position to measure velocity.
vx number The x component of velocity at point (x,y).
vy number The y component of velocity at point (x,y).
Body:getLocalCenter
Get the center of mass position in local coordinates.

Use Body:getWorldCenter to get the center of mass in world coordinates.
x, y = Body:getLocalCenter()
x number The x coordinate of the center of mass.
y number The y coordinate of the center of mass.
Body:getLocalPoint
Transform a point from world coordinates to local coordinates.
localX, localY = Body:getLocalPoint( worldX, worldY )
worldX number The x position in world coordinates.
worldY number The y position in world coordinates.
localX number The x position in local coordinates.
localY number The y position in local coordinates.
Body:getLocalPoints
Transforms multiple points from world coordinates to local coordinates.
x1, y1, x2, y2, ... = Body:getLocalPoints( x1, y1, x2, y2, ... )
x1 number (Argument) The x position of the first point.
y1 number (Argument) The y position of the first point.
x2 number (Argument) The x position of the second point.
y2 number (Argument) The y position of the second point.
... number (Argument) You can continue passing x and y position of the points.
x1 number (Result) The transformed x position of the first point.
y1 number (Result) The transformed y position of the first point.
x2 number (Result) The transformed x position of the second point.
y2 number (Result) The transformed y position of the second point.
... number (Result) Additional transformed x and y position of the points.
Body:getLocalVector
Transform a vector from world coordinates to local coordinates.
localX, localY = Body:getLocalVector( worldX, worldY )
worldX number The vector x component in world coordinates.
worldY number The vector y component in world coordinates.
localX number The vector x component in local coordinates.
localY number The vector y component in local coordinates.
Body:getMass
Get the mass of the body.

Static bodies always have a mass of 0.
mass = Body:getMass()
mass number The mass of the body (in kilograms).
Body:getMassData
Returns the mass, its center, and the rotational inertia.
x, y, mass, inertia = Body:getMassData()
x number The x position of the center of mass.
y number The y position of the center of mass.
mass number The mass of the body.
inertia number The rotational inertia.
Body:getPosition
Get the position of the body.

Note that this may not be the center of mass of the body.
x, y = Body:getPosition()
x number The x position.
y number The y position.
Body:getTransform
Get the position and angle of the body.

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.
x, y, angle = Body:getTransform()
x number The x component of the position.
y number The y component of the position.
angle number The angle in radians.
Body:getType
Returns the type of the body.
type = Body:getType()
type BodyType The body type.
Body:getUserData
Returns the Lua value associated with this Body.
value = Body:getUserData()
value any The Lua value associated with the Body.
Body:getWorld
Gets the World the body lives in.
world = Body:getWorld()
world World The world the body lives in.
Body:getWorldCenter
Get the center of mass position in world coordinates.

Use Body:getLocalCenter to get the center of mass in local coordinates.
x, y = Body:getWorldCenter()
x number The x coordinate of the center of mass.
y number The y coordinate of the center of mass.
Body:getWorldPoint
Transform a point from local coordinates to world coordinates.
worldX, worldY = Body:getWorldPoint( localX, localY )
localX number The x position in local coordinates.
localY number The y position in local coordinates.
worldX number The x position in world coordinates.
worldY number The y position in world coordinates.
Body:getWorldPoints
Transforms multiple points from local coordinates to world coordinates.
x1, y1, x2, y2 = Body:getWorldPoints( x1, y1, x2, y2 )
x1 number The x position of the first point.
y1 number The y position of the first point.
x2 number The x position of the second point.
y2 number The y position of the second point.
x1 number The transformed x position of the first point.
y1 number The transformed y position of the first point.
x2 number The transformed x position of the second point.
y2 number The transformed y position of the second point.
Body:getWorldVector
Transform a vector from local coordinates to world coordinates.
worldX, worldY = Body:getWorldVector( localX, localY )
localX number The vector x component in local coordinates.
localY number The vector y component in local coordinates.
worldX number The vector x component in world coordinates.
worldY number The vector y component in world coordinates.
Body:getX
Get the x position of the body in world coordinates.
x = Body:getX()
x number The x position in world coordinates.
Body:getY
Get the y position of the body in world coordinates.
y = Body:getY()
y number The y position in world coordinates.
Body:isActive
Returns whether the body is actively used in the simulation.
status = Body:isActive()
status boolean True if the body is active or false if not.
Body:isAwake
Returns the sleep status of the body.
status = Body:isAwake()
status boolean True if the body is awake or false if not.
Body:isBullet
Get the bullet status of a body.

There are two methods to check for body collisions:

* at their location when the world is updated (default)

* using continuous collision detection (CCD)

The default method is efficient, but a body moving very quickly may sometimes jump over another body without producing a collision. A body that is set as a bullet will use CCD. This is less efficient, but is guaranteed not to jump when moving quickly.

Note that static bodies (with zero mass) always use CCD, so your walls will not let a fast moving body pass through even if it is not a bullet.
status = Body:isBullet()
status boolean The bullet status of the body.
Body:isDestroyed
Gets whether the Body is destroyed. Destroyed bodies cannot be used.
destroyed = Body:isDestroyed()
destroyed boolean Whether the Body is destroyed.
Body:isFixedRotation
Returns whether the body rotation is locked.
fixed = Body:isFixedRotation()
fixed boolean True if the body's rotation is locked or false if not.
Body:isSleepingAllowed
Returns the sleeping behaviour of the body.
allowed = Body:isSleepingAllowed()
allowed boolean True if the body is allowed to sleep or false if not.
Body:isTouching
Gets whether the Body is touching the given other Body.
touching = Body:isTouching( otherbody )
otherbody Body The other body to check.
touching boolean True if this body is touching the other body, false otherwise.
Body:resetMassData
Resets the mass of the body by recalculating it from the mass properties of the fixtures.
Body:resetMassData()
Body:setActive
Sets whether the body is active in the world.

An inactive body does not take part in the simulation. It will not move or cause any collisions.
Body:setActive( active )
active boolean If the body is active or not.
Body:setAngle
Set the angle of the body.

The angle is measured in radians. If you need to transform it from degrees, use math.rad.

A value 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.

It is possible to cause a collision with another body by changing its angle.
Body:setAngle( angle )
angle number The angle in radians.
Body:setAngularDamping
Sets the angular damping of a Body

See Body:getAngularDamping for a definition of angular damping.

Angular damping can take any value from 0 to infinity. It is recommended to stay between 0 and 0.1, though. Other values will look unrealistic.
Body:setAngularDamping( damping )
damping number The new angular damping.
Body:setAngularVelocity
Sets the angular velocity of a Body.

The angular velocity is the ''rate of change of angle over time''.

This function will not accumulate anything; any impulses previously applied since the last call to World:update will be lost.
Body:setAngularVelocity( w )
w number The new angular velocity, in radians per second
Body:setAwake
Wakes the body up or puts it to sleep.
Body:setAwake( awake )
awake boolean The body sleep status.
Body:setBullet
Set the bullet status of a body.

There are two methods to check for body collisions:

* at their location when the world is updated (default)

* using continuous collision detection (CCD)

The default method is efficient, but a body moving very quickly may sometimes jump over another body without producing a collision. A body that is set as a bullet will use CCD. This is less efficient, but is guaranteed not to jump when moving quickly.

Note that static bodies (with zero mass) always use CCD, so your walls will not let a fast moving body pass through even if it is not a bullet.
Body:setBullet( status )
status boolean The bullet status of the body.
Body:setFixedRotation
Set whether a body has fixed rotation.

Bodies with fixed rotation don't vary the speed at which they rotate. Calling this function causes the mass to be reset.
Body:setFixedRotation( isFixed )
isFixed boolean Whether the body should have fixed rotation.
Body:setGravityScale
Sets a new gravity scale factor for the body.
Body:setGravityScale( scale )
scale number The new gravity scale factor.
Body:setInertia
Set the inertia of a body.
Body:setInertia( inertia )
inertia number The new moment of inertia, in kilograms * pixel squared.
Body:setLinearDamping
Sets the linear damping of a Body

See Body:getLinearDamping for a definition of linear damping.

Linear damping can take any value from 0 to infinity. It is recommended to stay between 0 and 0.1, though. Other values will make the objects look 'floaty'(if gravity is enabled).
Body:setLinearDamping( ld )
ld number The new linear damping
Body:setLinearVelocity
Sets a new linear velocity for the Body.

This function will not accumulate anything; any impulses previously applied since the last call to World:update will be lost.
Body:setLinearVelocity( x, y )
x number The x-component of the velocity vector.
y number The y-component of the velocity vector.
Body:setMass
Sets a new body mass.
Body:setMass( mass )
mass number The mass, in kilograms.
Body:setMassData
Overrides the calculated mass data.
Body:setMassData( x, y, mass, inertia )
x number The x position of the center of mass.
y number The y position of the center of mass.
mass number The mass of the body.
inertia number The rotational inertia.
Body:setPosition
Set the position of the body.

Note that this may not be the center of mass of the body.

This function cannot wake up the body.
Body:setPosition( x, y )
x number The x position.
y number The y position.
Body:setSleepingAllowed
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.
Body:setSleepingAllowed( allowed )
allowed boolean True if the body is allowed to sleep or false if not.
Body:setTransform
Set the position and angle of the body.

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.

This function cannot wake up the body.
Body:setTransform( x, y, angle )
x number The x component of the position.
y number The y component of the position.
angle number The angle in radians.
Body:setType
Sets a new body type.
Body:setType( type )
type BodyType The new type.
Body:setUserData
Associates a Lua value with the Body.

To delete the reference, explicitly pass nil.
Body:setUserData( value )
value any The Lua value to associate with the Body.
Body:setX
Set the x position of the body.

This function cannot wake up the body.
Body:setX( x )
x number The x position.
Body:setY
Set the y position of the body.

This function cannot wake up the body.
Body:setY( y )
y number The y position.
ChainShape:getChildEdge
Returns a child of the shape as an EdgeShape.
shape = ChainShape:getChildEdge( index )
index number The index of the child.
shape EdgeShape The child as an EdgeShape.
ChainShape:getNextVertex
Gets the vertex that establishes a connection to the next shape.

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.
x, y = ChainShape:getNextVertex()
x number The x-component of the vertex, or nil if ChainShape:setNextVertex hasn't been called.
y number The y-component of the vertex, or nil if ChainShape:setNextVertex hasn't been called.
ChainShape:getPoint
Returns a point of the shape.
x, y = ChainShape:getPoint( index )
index number The index of the point to return.
x number The x-coordinate of the point.
y number The y-coordinate of the point.
ChainShape:getPoints
Returns all points of the shape.
x1, y1, x2, y2 = ChainShape:getPoints()
x1 number The x-coordinate of the first point.
y1 number The y-coordinate of the first point.
x2 number The x-coordinate of the second point.
y2 number The y-coordinate of the second point.
ChainShape:getPreviousVertex
Gets the vertex that establishes a connection to the previous shape.

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.
x, y = ChainShape:getPreviousVertex()
x number The x-component of the vertex, or nil if ChainShape:setPreviousVertex hasn't been called.
y number The y-component of the vertex, or nil if ChainShape:setPreviousVertex hasn't been called.
ChainShape:getVertexCount
Returns the number of vertices the shape has.
count = ChainShape:getVertexCount()
count number The number of vertices.
ChainShape:setNextVertex
Sets a vertex that establishes a connection to the next shape.

This can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape.
ChainShape:setNextVertex( x, y )
x number The x-component of the vertex.
y number The y-component of the vertex.