Skip to main content

Body Class

Description:

  A class for creating Body objects.

__call

Type: Metamethod.

Description:

  Creates a new instance of Body.

Signature:

metamethod __call: function(
self: BodyClass,
def: BodyDef,
world: PhysicsWorld,
pos?: Vec2 --[[Vec2.zero]],
rot?: number --[[0]]
): Body -- class

Parameters:

ParameterTypeDescription
defBodyDefThe definition for the body to be created.
worldPhysicsWorldThe physics world where the body belongs.
posVec2[optional] The initial position of the body. Defaults to zero vector.
rotnumber[optional] The initial rotation angle of the body in degrees. Defaults to 0.

Returns:

Return TypeDescription
BodyThe newly created Body instance.