Difference between revisions of "love.physics.newWeldJoint"

m (Arguments)
m (Arguments)
Line 24: Line 24:
 
{{param|Body|body1|The first body to attach to the joint.}}
 
{{param|Body|body1|The first body to attach to the joint.}}
 
{{param|Body|body2|The second body to attach to the joint.}}
 
{{param|Body|body2|The second body to attach to the joint.}}
{{param|number|x1|The x position of the first anchor point. (local space body 1).}}
+
{{param|number|x1|The x position of the first anchor point (local space body 1).}}
{{param|number|y1|The y position of the first anchor point(local space body 1).}}
+
{{param|number|y1|The y position of the first anchor point (local space body 1).}}
{{param|number|x2|The x position of the second anchor point. (local space body 2).}}
+
{{param|number|x2|The x position of the second anchor point (local space body 2).}}
{{param|number|y2|The y position of the second anchor point. (local space body 2).}}
+
{{param|number|y2|The y position of the second anchor point (local space body 2).}}
 
{{param|boolean|collideConnected (false)|Specifies whether the two bodies should collide with each other.}}
 
{{param|boolean|collideConnected (false)|Specifies whether the two bodies should collide with each other.}}
 +
 
=== Returns ===
 
=== Returns ===
 
{{param|WeldJoint|joint|The new WeldJoint.}}
 
{{param|WeldJoint|joint|The new WeldJoint.}}

Revision as of 09:37, 26 November 2016

Available since LÖVE 0.8.0
This function is not supported in earlier versions.

Creates a constraint joint between two bodies. A WeldJoint essentially glues two bodies together. The constraint is a bit soft, however, due to Box2D's iterative solver.

Function

Synopsis

joint = love.physics.newWeldJoint( body1, body2, x, y, collideConnected )

Arguments

Body body1
The first body to attach to the joint.
Body body2
The second body to attach to the joint.
number x
The x position of the anchor point (world space).
number y
The y position of the anchor point (world space).
boolean collideConnected (false)
Specifies whether the two bodies should collide with each other.

Returns

WeldJoint joint
The new WeldJoint.

Function

Synopsis

joint = love.physics.newWeldJoint( body1, body2, x1, y1, x2, y2, collideConnected )

Arguments

Body body1
The first body to attach to the joint.
Body body2
The second body to attach to the joint.
number x1
The x position of the first anchor point (local space body 1).
number y1
The y position of the first anchor point (local space body 1).
number x2
The x position of the second anchor point (local space body 2).
number y2
The y position of the second anchor point (local space body 2).
boolean collideConnected (false)
Specifies whether the two bodies should collide with each other.

Returns

WeldJoint joint
The new WeldJoint.

Function

Available since LÖVE 0.10.2
This variant is not supported in earlier versions.


O.png There is a bug in 0.10.2 which causes position of the anchor points (x1, y1, x2, y2) in global coordinates instead of local (more https://bitbucket.org/rude/love/issues/1232/in-lovephysicsnewweldjoint-position-of-the).  


Synopsis

joint = love.physics.newWeldJoint( body1, body2, x1, y1, x2, y2, collideConnected, referenceAngle )

Arguments

Body body1
The first body to attach to the joint.
Body body2
The second body to attach to the joint.
number x1
The x position of the first anchor point (local space body 1).
number y1
The y position of the first anchor point (local space body 1).
number x2
The x position of the second anchor point (local space body 2).
number y2
The y position of the second anchor point (local space body 2).
boolean collideConnected (false)
Specifies whether the two bodies should collide with each other.
number referenceAngle (0)
The reference angle between body1 and body2, in radians.

Returns

WeldJoint joint
The new WeldJoint.

See Also

Other Languages