Difference between revisions of "love.physics.newPulleyJoint"
m |
m (It was PulleyJoint even in 0.7.x) |
||
(10 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
− | + | Creates a [[PulleyJoint]] to join two bodies to each other and the ground. | |
The pulley joint simulates a pulley with an optional block and tackle. If the ratio parameter has a value different from one, then the simulated rope extends faster on one side than the other. In a pulley joint the total length of the simulated rope is the constant <tt>length1 + ratio * length2</tt>, which is set when the pulley joint is created. | The pulley joint simulates a pulley with an optional block and tackle. If the ratio parameter has a value different from one, then the simulated rope extends faster on one side than the other. In a pulley joint the total length of the simulated rope is the constant <tt>length1 + ratio * length2</tt>, which is set when the pulley joint is created. | ||
Pulley joints can behave unpredictably if one side is fully extended. It is recommended that the method [[PulleyJoint:setMaxLengths | setMaxLengths ]] be used to constrain the maximum lengths each side can attain. | Pulley joints can behave unpredictably if one side is fully extended. It is recommended that the method [[PulleyJoint:setMaxLengths | setMaxLengths ]] be used to constrain the maximum lengths each side can attain. | ||
+ | |||
+ | [[File:physicsJointPulley.png]] | ||
== Function == | == Function == | ||
+ | {{newin|[[0.8.0]]|080|type=variant}} | ||
=== Synopsis === | === Synopsis === | ||
<source lang="lua"> | <source lang="lua"> | ||
− | joint = newPulleyJoint( body1, body2, gx1, gy1, gx2, gy2, x1, y1, x2, y2, ratio ) | + | joint = love.physics.newPulleyJoint( body1, body2, gx1, gy1, gx2, gy2, x1, y1, x2, y2, ratio, collideConnected ) |
</source> | </source> | ||
=== Arguments === | === Arguments === | ||
Line 21: | Line 24: | ||
{{param|number|x2|The x coordinate of the pulley joint anchor in the second body.}} | {{param|number|x2|The x coordinate of the pulley joint anchor in the second body.}} | ||
{{param|number|y2|The y coordinate of the pulley joint anchor in the second body.}} | {{param|number|y2|The y coordinate of the pulley joint anchor in the second body.}} | ||
− | {{param|number|ratio|The joint ratio.}} | + | {{param|number|ratio (1)|The joint ratio.}} |
+ | {{param|boolean|collideConnected (true)|Specifies whether the two bodies should collide with each other.}} | ||
=== Returns === | === Returns === | ||
− | {{param| | + | {{param|PulleyJoint|joint|The new pulley joint.}} |
+ | |||
+ | == Function == | ||
+ | {{oldin|[[0.8.0]]|080|type=variant}} | ||
+ | === Synopsis === | ||
+ | <source lang="lua"> | ||
+ | joint = love.physics.newPulleyJoint( body1, body2, gx1, gy1, gx2, gy2, x1, y1, x2, y2, ratio ) | ||
+ | </source> | ||
+ | === Arguments === | ||
+ | {{param|Body|body1|The first body to connect with a pulley joint.}} | ||
+ | {{param|Body|body2|The second body to connect with a pulley joint.}} | ||
+ | {{param|number|gx1|The x coordinate of the first body's ground anchor.}} | ||
+ | {{param|number|gy1|The y coordinate of the first body's ground anchor.}} | ||
+ | {{param|number|gx2|The x coordinate of the second body's ground anchor.}} | ||
+ | {{param|number|gy2|The y coordinate of the second body's ground anchor.}} | ||
+ | {{param|number|x1|The x coordinate of the pulley joint anchor in the first body.}} | ||
+ | {{param|number|y1|The y coordinate of the pulley joint anchor in the first body.}} | ||
+ | {{param|number|x2|The x coordinate of the pulley joint anchor in the second body.}} | ||
+ | {{param|number|y2|The y coordinate of the pulley joint anchor in the second body.}} | ||
+ | {{param|number|ratio (1)|The joint ratio.}} | ||
+ | === Returns === | ||
+ | {{param|PulleyJoint|joint|The new pulley joint.}} | ||
+ | |||
== See Also == | == See Also == | ||
* [[parent::love.physics]] | * [[parent::love.physics]] | ||
+ | * [[Constructs::PulleyJoint]] | ||
+ | * [[Constructs::Joint]] | ||
[[Category:Functions]] | [[Category:Functions]] | ||
− | {{#set:Description= | + | {{#set:Description=Creates a [[PulleyJoint]] to join two bodies to each other and the ground.}} |
− | }} | + | {{#set:Since=000}} |
== Other Languages == | == Other Languages == | ||
{{i18n|love.physics.newPulleyJoint}} | {{i18n|love.physics.newPulleyJoint}} |
Latest revision as of 18:55, 26 December 2016
Creates a PulleyJoint to join two bodies to each other and the ground.
The pulley joint simulates a pulley with an optional block and tackle. If the ratio parameter has a value different from one, then the simulated rope extends faster on one side than the other. In a pulley joint the total length of the simulated rope is the constant length1 + ratio * length2, which is set when the pulley joint is created.
Pulley joints can behave unpredictably if one side is fully extended. It is recommended that the method setMaxLengths be used to constrain the maximum lengths each side can attain.
Contents
Function
Available since LÖVE 0.8.0 |
This variant is not supported in earlier versions. |
Synopsis
joint = love.physics.newPulleyJoint( body1, body2, gx1, gy1, gx2, gy2, x1, y1, x2, y2, ratio, collideConnected )
Arguments
Body body1
- The first body to connect with a pulley joint.
Body body2
- The second body to connect with a pulley joint.
number gx1
- The x coordinate of the first body's ground anchor.
number gy1
- The y coordinate of the first body's ground anchor.
number gx2
- The x coordinate of the second body's ground anchor.
number gy2
- The y coordinate of the second body's ground anchor.
number x1
- The x coordinate of the pulley joint anchor in the first body.
number y1
- The y coordinate of the pulley joint anchor in the first body.
number x2
- The x coordinate of the pulley joint anchor in the second body.
number y2
- The y coordinate of the pulley joint anchor in the second body.
number ratio (1)
- The joint ratio.
boolean collideConnected (true)
- Specifies whether the two bodies should collide with each other.
Returns
PulleyJoint joint
- The new pulley joint.
Function
Removed in LÖVE 0.8.0 |
This variant is not supported in that and later versions. |
Synopsis
joint = love.physics.newPulleyJoint( body1, body2, gx1, gy1, gx2, gy2, x1, y1, x2, y2, ratio )
Arguments
Body body1
- The first body to connect with a pulley joint.
Body body2
- The second body to connect with a pulley joint.
number gx1
- The x coordinate of the first body's ground anchor.
number gy1
- The y coordinate of the first body's ground anchor.
number gx2
- The x coordinate of the second body's ground anchor.
number gy2
- The y coordinate of the second body's ground anchor.
number x1
- The x coordinate of the pulley joint anchor in the first body.
number y1
- The y coordinate of the pulley joint anchor in the first body.
number x2
- The x coordinate of the pulley joint anchor in the second body.
number y2
- The y coordinate of the pulley joint anchor in the second body.
number ratio (1)
- The joint ratio.
Returns
PulleyJoint joint
- The new pulley joint.
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