Difference between revisions of "love.physics.newWeldJoint"
Antoniomoder (talk | contribs) m |
(Added warning to not call during callbacks) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{newin|[[0.8.0]]|080|type=function}} | {{newin|[[0.8.0]]|080|type=function}} | ||
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. | 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. | ||
+ | |||
+ | {{notice|Making changes to a [[World]] is not allowed inside of the [[beginContact]], [[endContact]], [[preSolve]], and [[postSolve]] callback functions, as BOX2D locks the world during these callbacks.}} | ||
== Function == | == Function == | ||
Line 24: | Line 26: | ||
{{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 | + | {{param|number|x1|The x position of the first anchor point (world space).}} |
− | {{param|number|y1|The y position of the first anchor point | + | {{param|number|y1|The y position of the first anchor point (world space).}} |
− | {{param|number|x2|The x position of the second anchor point | + | {{param|number|x2|The x position of the second anchor point (world space).}} |
− | {{param|number|y2|The y position of the second anchor point | + | {{param|number|y2|The y position of the second anchor point (world space).}} |
{{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.}} | ||
Line 35: | Line 38: | ||
{{newin|[[0.10.2]]|102|type=variant}} | {{newin|[[0.10.2]]|102|type=variant}} | ||
− | |||
=== Synopsis === | === Synopsis === | ||
<source lang="lua"> | <source lang="lua"> | ||
Line 43: | Line 45: | ||
{{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 | + | {{param|number|x1|The x position of the first anchor point (world space).}} |
− | {{param|number|y1|The y position of the first anchor point | + | {{param|number|y1|The y position of the first anchor point (world space).}} |
− | {{param|number|x2|The x position of the second anchor point | + | {{param|number|x2|The x position of the second anchor point (world space).}} |
− | {{param|number|y2|The y position of the second anchor point | + | {{param|number|y2|The y position of the second anchor point (world space).}} |
{{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.}} | ||
{{param|number|referenceAngle (0)|The reference angle between body1 and body2, in radians.}} | {{param|number|referenceAngle (0)|The reference angle between body1 and body2, in radians.}} | ||
+ | |||
=== Returns === | === Returns === | ||
{{param|WeldJoint|joint|The new WeldJoint.}} | {{param|WeldJoint|joint|The new WeldJoint.}} |
Latest revision as of 07:39, 14 October 2018
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.
Making changes to a World is not allowed inside of the beginContact, endContact, preSolve, and postSolve callback functions, as BOX2D locks the world during these callbacks. |
Contents
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 (world space).
number y1
- The y position of the first anchor point (world space).
number x2
- The x position of the second anchor point (world space).
number y2
- The y position of the second anchor point (world space).
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. |
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 (world space).
number y1
- The y position of the first anchor point (world space).
number x2
- The x position of the second anchor point (world space).
number y2
- The y position of the second anchor point (world space).
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
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info