Skip to main content

Joint

Description:

  Attach multiple bodies together to interact in unique ways.

type

Type: Function.

Description:

  Gets the type of the object as a string.

Signature:

type: function(self: Joint): string

Returns:

Return TypeDescription
stringThe type as a string.

Of

Type: Function.

Description:

  Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.

Signature:

typeOf: function(self: Joint, type_name: string): boolean

Parameters:

ParameterTypeDescription
type_namestringThe name of the type to check for.

Returns:

Return TypeDescription
booleanTrue if the object is of the specified type, false otherwise.

release

Type: Function.

Description:

  Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread. This method can be used to immediately clean up resources without waiting for Lua's garbage collector.

Signature:

release: function(self: Joint): boolean

Returns:

Return TypeDescription
booleanTrue if the object was released by this call, false if it had been previously released.

destroy

Type: Function.

Description:

  Explicitly destroys the Joint. 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.

Signature:

destroy: function(self: Joint)

isDestroyed

Type: Function.

Description:

  Gets whether the Joint is destroyed. Destroyed joints cannot be used.

Signature:

isDestroyed: function(self: Joint): boolean

Returns:

Return TypeDescription
booleanWhether the Joint is destroyed.

getType

Type: Function.

Description:

  Gets a string representing the type.

Signature:

getType: function(self: Joint): string

Returns:

Return TypeDescription
stringA string with the name of the Joint type.

getBodies

Type: Function.

Description:

  Gets the bodies that the Joint is attached to.

Signature:

getBodies: function(self: Joint): Body, Body

Returns:

Return TypeDescription
BodyThe first Body.
BodyThe second Body.

getAnchors

Type: Function.

Description:

  Get the anchor points of the joint.

Signature:

getAnchors: function(self: Joint): number, number, number, number

Returns:

Return TypeDescription
numberThe x-component of the anchor on Body 1.
numberThe y-component of the anchor on Body 1.
numberThe x-component of the anchor on Body 2.
numberThe y-component of the anchor on Body 2.

getReactionForce

Type: Function.

Description:

  Returns the reaction force in newtons on the second body

Signature:

getReactionForce: function(self: Joint, inverse_delta_time: number): number, number

Parameters:

ParameterTypeDescription
inverse_delta_timenumberHow long the force applies. Usually the inverse time step or 1/dt.

Returns:

Return TypeDescription
numberThe x-component of the force.
numberThe y-component of the force.

getReactionTorque

Type: Function.

Description:

  Returns the reaction torque on the second body.

Signature:

getReactionTorque: function(self: Joint, inverse_delta_time: number): number

Parameters:

ParameterTypeDescription
inverse_delta_timenumberHow long the force applies. Usually the inverse time step or 1/dt.

Returns:

Return TypeDescription
numberThe reaction torque on the second body.

getCollideConnected

Type: Function.

Description:

  Gets whether the connected Bodies collide.

Signature:

getCollideConnected: function(self: Joint): boolean

Returns:

Return TypeDescription
booleanTrue if they collide, false otherwise.

setUserData

Type: Function.

Description:

  Associates a Lua value with the Joint. To delete the reference, explicitly pass nil.

Signature:

setUserData: function(self: Joint, value: any)

Parameters:

ParameterTypeDescription
valueanyThe Lua value to associate with the Joint.

getUserData

Type: Function.

Description:

  Returns the Lua value associated with this Joint.

Signature:

getUserData: function(self: Joint): any
setLength: function(self: Joint, length: number)
getLength: function(self: Joint): number
setFrequency: function(self: Joint, frequency: number)
getFrequency: function(self: Joint): number
setDampingRatio: function(self: Joint, ratio: number)
getDampingRatio: function(self: Joint): number
getJointAngle: function(self: Joint): number
getJointSpeed: function(self: Joint): number
setMotorEnabled: function(self: Joint, enabled: boolean)
isMotorEnabled: function(self: Joint): boolean
setMaxMotorTorque: function(self: Joint, torque: number)
getMaxMotorTorque: function(self: Joint): number
setMotorSpeed: function(self: Joint, speed: number)
getMotorSpeed: function(self: Joint): number
getMotorTorque: function(self: Joint, inverse_delta_time: number): number
setLimitsEnabled: function(self: Joint, enabled: boolean)
areLimitsEnabled: function(self: Joint): boolean
hasLimitsEnabled: function(self: Joint): boolean
setUpperLimit: function(self: Joint, upper: number)
setLowerLimit: function(self: Joint, lower: number)
setLimits: function(self: Joint, lower: number, upper: number)
getUpperLimit: function(self: Joint): number
getLowerLimit: function(self: Joint): number
getLimits: function(self: Joint): number, number
getReferenceAngle: function(self: Joint): number
getJointTranslation: function(self: Joint): number
setMaxMotorForce: function(self: Joint, force: number)
getMaxMotorForce: function(self: Joint): number
getMotorForce: function(self: Joint, inverse_delta_time: number): number
getAxis: function(self: Joint): number, number
setMaxForce: function(self: Joint, force: number)
getMaxForce: function(self: Joint): number
setMaxTorque: function(self: Joint, torque: number)
getMaxTorque: function(self: Joint): number
setMaxLength: function(self: Joint, length: number)
getMaxLength: function(self: Joint): number
getGroundAnchors: function(self: Joint): number, number, number, number
getLengthA: function(self: Joint): number
getLengthB: function(self: Joint): number
getRatio: function(self: Joint): number
setSpringFrequency: function(self: Joint, frequency: number)
getSpringFrequency: function(self: Joint): number
setSpringDampingRatio: function(self: Joint, ratio: number)
getSpringDampingRatio: function(self: Joint): number
setTarget: function(self: Joint, x: number, y: number)
getTarget: function(self: Joint): number, number
setLinearOffset: function(self: Joint, x: number, y: number)
getLinearOffset: function(self: Joint): number, number
setAngularOffset: function(self: Joint, angle: number)
getAngularOffset: function(self: Joint): number
setCorrectionFactor: function(self: Joint, factor: number)
getCorrectionFactor: function(self: Joint): number
setRatio: function(self: Joint, ratio: number)
getJoints: function(self: Joint): Joint, Joint

Parameters:

ParameterTypeDescription
lengthnumberThe length parameter.
frequencynumberThe frequency parameter.
rationumberThe ratio parameter.
enabledbooleanThe enabled parameter.
torquenumberThe torque parameter.
speednumberThe speed parameter.
inverse_delta_timenumberThe inverse_delta_time parameter.
uppernumberThe upper parameter.
lowernumberThe lower parameter.
forcenumberThe force parameter.
xnumberThe x parameter.
ynumberThe y parameter.
anglenumberThe angle parameter.
factornumberThe factor parameter.

Returns:

Return TypeDescription
any or number or boolean or JointThe Lua value associated with the Joint.